diff --git a/app/assets/javascripts/admin/services/admin-tools.js.es6 b/app/assets/javascripts/admin/services/admin-tools.js.es6
index ba6bd987411..4a055b0daf0 100644
--- a/app/assets/javascripts/admin/services/admin-tools.js.es6
+++ b/app/assets/javascripts/admin/services/admin-tools.js.es6
@@ -88,7 +88,7 @@ export default Ember.Service.extend({
_deleteSpammer(adminUser) {
// Try loading the email if the site supports it
- let tryEmail = this.siteSettings.show_email_on_profile
+ let tryEmail = this.siteSettings.moderators_view_emails
? adminUser.checkEmail()
: Ember.RSVP.resolve();
diff --git a/app/assets/javascripts/discourse/mixins/can-check-emails.js.es6 b/app/assets/javascripts/discourse/mixins/can-check-emails.js.es6
index b9d1142fa20..a7eb59fe7b6 100644
--- a/app/assets/javascripts/discourse/mixins/can-check-emails.js.es6
+++ b/app/assets/javascripts/discourse/mixins/can-check-emails.js.es6
@@ -2,7 +2,7 @@ import { propertyEqual, setting } from "discourse/lib/computed";
export default Ember.Mixin.create({
isCurrentUser: propertyEqual("model.id", "currentUser.id"),
- showEmailOnProfile: setting("show_email_on_profile"),
+ showEmailOnProfile: setting("moderators_view_emails"),
canStaffCheckEmails: Ember.computed.and(
"showEmailOnProfile",
"currentUser.staff"
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 7c403971349..224d94f446f 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -1386,7 +1386,7 @@ en:
ga_universal_auto_link_domains: "Enable Google Universal Analytics (analytics.js) cross-domain tracking. Outgoing links to these domains will have the client id added to them. See Google's Cross-Domain Tracking guide."
gtm_container_id: "Google Tag Manager container id. eg: GTM-ABCDEF.
Note: third-party scripts loaded by GTM may need to be whitelisted in 'content security policy script src'."
enable_escaped_fragments: "Fall back to Google's Ajax-Crawling API if no webcrawler is detected. See https://developers.google.com/webmasters/ajax-crawling/docs/learn-more"
- allow_moderators_to_create_categories: "Allow moderators to create new categories"
+ moderators_create_categories: "Allow moderators to create new categories"
cors_origins: "Allowed origins for cross-origin requests (CORS). Each origin must include http:// or https://. The DISCOURSE_ENABLE_CORS env variable must be set to true to enable CORS."
use_admin_ip_whitelist: "Admins can only log in if they are at an IP address defined in the Screened IPs list (Admin > Logs > Screened Ips)."
blacklist_ip_blocks: "A list of private IP blocks that should never be crawled by Discourse"
@@ -1418,7 +1418,7 @@ en:
topics_per_period_in_top_page: "Number of top topics shown on the expanded 'Show More' top topics."
redirect_users_to_top_page: "Automatically redirect new and long absent users to the top page."
top_page_default_timeframe: "Default timeframe for the top view page."
- show_email_on_profile: "Allow moderators to view user emails"
+ moderators_view_emails: "Allow moderators to view user emails"
prioritize_username_in_ux: "Show username first on user page, user card and posts (when disabled name is shown first)"
enable_rich_text_paste: "Enable automatic HTML to Markdown conversion when pasting text into the composer. (Experimental)"
diff --git a/config/site_settings.yml b/config/site_settings.yml
index 24e69ece6f2..9155d1292ea 100644
--- a/config/site_settings.yml
+++ b/config/site_settings.yml
@@ -490,9 +490,6 @@ users:
default: 15
min: 1
redirect_users_to_top_page: true
- show_email_on_profile:
- client: true
- default: false
prioritize_username_in_ux:
client: true
default: true
@@ -1228,7 +1225,10 @@ security:
regex: "^(Lax|Strict|Disabled)$"
enable_escaped_fragments: true
allow_index_in_robots_txt: true
- allow_moderators_to_create_categories: false
+ moderators_create_categories: false
+ moderators_view_emails:
+ client: true
+ default: false
non_crawler_user_agents:
hidden: true
default: "trident|webkit|gecko|chrome|safari|msie|opera|goanna"
diff --git a/db/migrate/20190313205652_rename_moderator_site_settings.rb b/db/migrate/20190313205652_rename_moderator_site_settings.rb
new file mode 100644
index 00000000000..ff0747c98de
--- /dev/null
+++ b/db/migrate/20190313205652_rename_moderator_site_settings.rb
@@ -0,0 +1,11 @@
+class RenameModeratorSiteSettings < ActiveRecord::Migration[5.2]
+ def up
+ execute "UPDATE site_settings SET name = 'moderators_view_emails' WHERE name = 'show_email_on_profile'"
+ execute "UPDATE site_settings SET name = 'moderators_create_categories' WHERE name = 'allow_moderators_to_create_categories'"
+ end
+
+ def down
+ execute "UPDATE site_settings SET name = 'show_email_on_profile' WHERE name = 'moderators_view_emails'"
+ execute "UPDATE site_settings SET name = 'allow_moderators_to_create_categories' WHERE name = 'moderators_create_categories'"
+ end
+end
diff --git a/lib/guardian/category_guardian.rb b/lib/guardian/category_guardian.rb
index 92572105e74..116105f5640 100644
--- a/lib/guardian/category_guardian.rb
+++ b/lib/guardian/category_guardian.rb
@@ -5,7 +5,7 @@ module CategoryGuardian
def can_create_category?(parent = nil)
is_admin? ||
(
- SiteSetting.allow_moderators_to_create_categories &&
+ SiteSetting.moderators_create_categories &&
is_moderator?
)
end
@@ -14,7 +14,7 @@ module CategoryGuardian
def can_edit_category?(category)
is_admin? ||
(
- SiteSetting.allow_moderators_to_create_categories &&
+ SiteSetting.moderators_create_categories &&
is_moderator? &&
can_see_category?(category)
)
diff --git a/lib/guardian/user_guardian.rb b/lib/guardian/user_guardian.rb
index 6751159503a..4bfbc094f1a 100644
--- a/lib/guardian/user_guardian.rb
+++ b/lib/guardian/user_guardian.rb
@@ -67,7 +67,7 @@ module UserGuardian
end
def can_check_emails?(user)
- is_admin? || (is_staff? && SiteSetting.show_email_on_profile)
+ is_admin? || (is_staff? && SiteSetting.moderators_view_emails)
end
def restrict_user_fields?(user)
diff --git a/lib/site_settings/deprecated_settings.rb b/lib/site_settings/deprecated_settings.rb
index c5f5392ef2c..377e540c842 100644
--- a/lib/site_settings/deprecated_settings.rb
+++ b/lib/site_settings/deprecated_settings.rb
@@ -11,7 +11,9 @@ module SiteSettings::DeprecatedSettings
['apple_touch_icon_url', 'apple_touch_icon', false, '2.3'],
['default_opengraph_image_url', 'opengraph_image', false, '2.3'],
['twitter_summary_large_image_url', 'twitter_summary_large_image', false, '2.3'],
- ['push_notifications_icon_url', 'push_notifications_icon', false, '2.3']
+ ['push_notifications_icon_url', 'push_notifications_icon', false, '2.3'],
+ ['show_email_on_profile', 'moderators_view_emails', true, '2.4'],
+ ['allow_moderators_to_create_categories', 'moderators_create_categories', true, '2.4']
]
def setup_deprecated_methods
diff --git a/spec/serializers/admin_user_list_serializer_spec.rb b/spec/serializers/admin_user_list_serializer_spec.rb
index 7f50c378310..9a21b687826 100644
--- a/spec/serializers/admin_user_list_serializer_spec.rb
+++ b/spec/serializers/admin_user_list_serializer_spec.rb
@@ -41,16 +41,16 @@ describe AdminUserListSerializer do
expect(json[:secondary_emails]).to eq(nil)
end
- it "doesn't return emails for a moderator request when show_email_on_profile is disabled" do
- SiteSetting.show_email_on_profile = false
+ it "doesn't return emails for a moderator request when moderators_view_emails is disabled" do
+ SiteSetting.moderators_view_emails = false
fabricate_secondary_emails_for(user)
json = serialize(user, moderator, emails_desired: true)
expect(json[:email]).to eq(nil)
expect(json[:secondary_emails]).to eq(nil)
end
- it "returns emails for a moderator request when show_email_on_profile is enabled" do
- SiteSetting.show_email_on_profile = true
+ it "returns emails for a moderator request when moderators_view_emails is enabled" do
+ SiteSetting.moderators_view_emails = true
fabricate_secondary_emails_for(user)
json = serialize(user, moderator, emails_desired: true)
expect(json[:email]).to eq("user@email.com")