Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions WordPress/Classes/ViewRelated/Blog/SiteSettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
// 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 {
// 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;
Expand Down Expand Up @@ -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 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.");
}
break;
}
case SiteSettingsSectionAdvanced:
headingTitle = NSLocalizedString(@"Advanced", @"Title for the advanced section in site settings screen");
break;
Expand Down Expand Up @@ -695,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];
}
}
}
};
Expand Down Expand Up @@ -825,6 +833,10 @@ - (void)toggleGeolocation:(BOOL)value
[[ContextManager sharedInstance] saveContext:self.blog.managedObjectContext];
}

- (BOOL)blogSupportsSavingWritingDefaults
{
return [self.blog supports:BlogFeatureWPComRESTAPI] && self.blog.isAdmin;
}

#pragma mark - Authentication methods

Expand Down Expand Up @@ -1012,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