From 943b8bd5566d7f9b79227a5d94c14509cfc62020 Mon Sep 17 00:00:00 2001 From: kurzee Date: Mon, 1 Feb 2016 11:46:59 -0600 Subject: [PATCH 1/5] Adds copy for noting that Writing settings are saved within the app. --- .../Classes/ViewRelated/Blog/SiteSettingsViewController.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m b/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m index a82d5fe807b2..09f9d40885fa 100644 --- a/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m +++ b/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m @@ -544,8 +544,14 @@ - (NSString *)titleForHeaderInSection:(NSInteger)section headingTitle = NSLocalizedString(@"Account", @"Title for the account section in site settings screen"); break; case SiteSettingsSectionWriting: - headingTitle = NSLocalizedString(@"Writing", @"Title for the writing section in site settings screen"); + { + if ([self.blog supports:BlogFeatureWPComRESTAPI]) { + headingTitle = NSLocalizedString(@"Writing", @"Title for the writing section in site settings screen"); + } else { + headingTitle = NSLocalizedString(@"Writing (App Defaults)", @"Title for the writing section in site settings screen when the settings are saved only within the app."); + } break; + } case SiteSettingsSectionAdvanced: headingTitle = NSLocalizedString(@"Advanced", @"Title for the advanced section in site settings screen"); break; From 8b3477f4f3de50d6e171c95e1da9eb4436d8d3fc Mon Sep 17 00:00:00 2001 From: kurzee Date: Mon, 1 Feb 2016 11:48:42 -0600 Subject: [PATCH 2/5] Updates Writing section for rows with XML-RPC users and REST users. Enables showing the writing section to admin and non-admin users of XML-RCP while retaining usual REST rows. --- .../Blog/SiteSettingsViewController.m | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m b/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m index 09f9d40885fa..b0df328b2a65 100644 --- a/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m +++ b/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m @@ -195,17 +195,17 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger return SiteSettingsAccountCount; } case SiteSettingsSectionWriting: { - if (!self.blog.isAdmin) { - // If we're not admin, we just want to show the geotagging cell - return 1; - } - NSInteger rowsToHide = 0; - if (![self.blog supports:BlogFeatureWPComRESTAPI]) { + if ([self.blog supports:BlogFeatureWPComRESTAPI]) { + if (!self.blog.isAdmin) { + // If we're not admin, we just want to show the geotagging cell + return 1; + } + return SiteSettingsWritingCount; + } else { // NOTE: Sergio Estevao (2015-09-23): Hides the related post for self-hosted sites not in jetpack // because this options is not available for them. - rowsToHide += 1; + return SiteSettingsWritingCount - 1; } - return SiteSettingsWritingCount - rowsToHide; } case SiteSettingsSectionDiscussion: { return 1; From ce194c9db3627b5933e1938d662f41e9ca08f583 Mon Sep 17 00:00:00 2001 From: kurzee Date: Mon, 1 Feb 2016 11:49:19 -0600 Subject: [PATCH 3/5] Saves settings for Writing defaults on REST blogs only. --- .../ViewRelated/Blog/SiteSettingsViewController.m | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m b/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m index b0df328b2a65..34545969b7d1 100644 --- a/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m +++ b/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m @@ -701,7 +701,9 @@ - (void)showPostFormatSelector if ([status isKindOfClass:[NSString class]]) { if (weakSelf.blog.settings.defaultPostFormat != status) { weakSelf.blog.settings.defaultPostFormat = status; - [weakSelf saveSettings]; + if ([weakSelf blogSupportsSavingWritingDefaults]) { + [weakSelf saveSettings]; + } } } }; @@ -831,6 +833,10 @@ - (void)toggleGeolocation:(BOOL)value [[ContextManager sharedInstance] saveContext:self.blog.managedObjectContext]; } +- (BOOL)blogSupportsSavingWritingDefaults +{ + return [self.blog supports:BlogFeatureWPComRESTAPI]; +} #pragma mark - Authentication methods @@ -1018,7 +1024,10 @@ - (void)postCategoriesViewController:(PostCategoriesViewController *)controller { self.blog.settings.defaultCategoryID = category.categoryID; self.defaultCategoryCell.detailTextLabel.text = category.categoryName; - [self saveSettings]; + + if ([self blogSupportsSavingWritingDefaults]) { + [self saveSettings]; + } } @end From 76f3cce31966c6332249d0a9f487e17b1a4421f9 Mon Sep 17 00:00:00 2001 From: kurzee Date: Mon, 1 Feb 2016 12:16:01 -0600 Subject: [PATCH 4/5] Allows non-admin users access to default category and format options. --- .../Classes/ViewRelated/Blog/SiteSettingsViewController.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m b/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m index 34545969b7d1..b041457d58df 100644 --- a/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m +++ b/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m @@ -197,8 +197,8 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger case SiteSettingsSectionWriting: { if ([self.blog supports:BlogFeatureWPComRESTAPI]) { if (!self.blog.isAdmin) { - // If we're not admin, we just want to show the geotagging cell - return 1; + // NOTE: Brent Coursey (2016-02-01): Hides the related post for non-admin users as they cannot change this option. + return SiteSettingsWritingCount - 1; } return SiteSettingsWritingCount; } else { @@ -835,7 +835,7 @@ - (void)toggleGeolocation:(BOOL)value - (BOOL)blogSupportsSavingWritingDefaults { - return [self.blog supports:BlogFeatureWPComRESTAPI]; + return [self.blog supports:BlogFeatureWPComRESTAPI] && self.blog.isAdmin; } #pragma mark - Authentication methods From 30c7b02b14f00a71e592e0fb1ecf68615232c2d9 Mon Sep 17 00:00:00 2001 From: kurzee Date: Mon, 1 Feb 2016 12:19:57 -0600 Subject: [PATCH 5/5] Shows the amended section label when the user is only using defaults locally. --- WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m b/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m index b041457d58df..37a74f93e0dd 100644 --- a/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m +++ b/WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m @@ -545,7 +545,7 @@ - (NSString *)titleForHeaderInSection:(NSInteger)section break; case SiteSettingsSectionWriting: { - if ([self.blog supports:BlogFeatureWPComRESTAPI]) { + if ([self blogSupportsSavingWritingDefaults]) { headingTitle = NSLocalizedString(@"Writing", @"Title for the writing section in site settings screen"); } else { headingTitle = NSLocalizedString(@"Writing (App Defaults)", @"Title for the writing section in site settings screen when the settings are saved only within the app.");