REFACTOR: Rename site settings to make them less confusing
This commit is contained in:
parent
6f6dea87f3
commit
c34a6ba674
|
@ -88,7 +88,7 @@ export default Ember.Service.extend({
|
||||||
|
|
||||||
_deleteSpammer(adminUser) {
|
_deleteSpammer(adminUser) {
|
||||||
// Try loading the email if the site supports it
|
// 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()
|
? adminUser.checkEmail()
|
||||||
: Ember.RSVP.resolve();
|
: Ember.RSVP.resolve();
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { propertyEqual, setting } from "discourse/lib/computed";
|
||||||
|
|
||||||
export default Ember.Mixin.create({
|
export default Ember.Mixin.create({
|
||||||
isCurrentUser: propertyEqual("model.id", "currentUser.id"),
|
isCurrentUser: propertyEqual("model.id", "currentUser.id"),
|
||||||
showEmailOnProfile: setting("show_email_on_profile"),
|
showEmailOnProfile: setting("moderators_view_emails"),
|
||||||
canStaffCheckEmails: Ember.computed.and(
|
canStaffCheckEmails: Ember.computed.and(
|
||||||
"showEmailOnProfile",
|
"showEmailOnProfile",
|
||||||
"currentUser.staff"
|
"currentUser.staff"
|
||||||
|
|
|
@ -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 <a href='https://support.google.com/analytics/answer/1034342?hl=en' target='_blank'>Google's Cross-Domain Tracking guide.</a>"
|
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 <a href='https://support.google.com/analytics/answer/1034342?hl=en' target='_blank'>Google's Cross-Domain Tracking guide.</a>"
|
||||||
gtm_container_id: "Google Tag Manager container id. eg: GTM-ABCDEF. <br/>Note: third-party scripts loaded by GTM may need to be whitelisted in 'content security policy script src'."
|
gtm_container_id: "Google Tag Manager container id. eg: GTM-ABCDEF. <br/>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 <a href='https://developers.google.com/webmasters/ajax-crawling/docs/learn-more' target='_blank'>https://developers.google.com/webmasters/ajax-crawling/docs/learn-more</a>"
|
enable_escaped_fragments: "Fall back to Google's Ajax-Crawling API if no webcrawler is detected. See <a href='https://developers.google.com/webmasters/ajax-crawling/docs/learn-more' target='_blank'>https://developers.google.com/webmasters/ajax-crawling/docs/learn-more</a>"
|
||||||
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."
|
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)."
|
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"
|
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."
|
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."
|
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."
|
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)"
|
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)"
|
enable_rich_text_paste: "Enable automatic HTML to Markdown conversion when pasting text into the composer. (Experimental)"
|
||||||
|
|
||||||
|
|
|
@ -490,9 +490,6 @@ users:
|
||||||
default: 15
|
default: 15
|
||||||
min: 1
|
min: 1
|
||||||
redirect_users_to_top_page: true
|
redirect_users_to_top_page: true
|
||||||
show_email_on_profile:
|
|
||||||
client: true
|
|
||||||
default: false
|
|
||||||
prioritize_username_in_ux:
|
prioritize_username_in_ux:
|
||||||
client: true
|
client: true
|
||||||
default: true
|
default: true
|
||||||
|
@ -1228,7 +1225,10 @@ security:
|
||||||
regex: "^(Lax|Strict|Disabled)$"
|
regex: "^(Lax|Strict|Disabled)$"
|
||||||
enable_escaped_fragments: true
|
enable_escaped_fragments: true
|
||||||
allow_index_in_robots_txt: 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:
|
non_crawler_user_agents:
|
||||||
hidden: true
|
hidden: true
|
||||||
default: "trident|webkit|gecko|chrome|safari|msie|opera|goanna"
|
default: "trident|webkit|gecko|chrome|safari|msie|opera|goanna"
|
||||||
|
|
|
@ -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
|
|
@ -5,7 +5,7 @@ module CategoryGuardian
|
||||||
def can_create_category?(parent = nil)
|
def can_create_category?(parent = nil)
|
||||||
is_admin? ||
|
is_admin? ||
|
||||||
(
|
(
|
||||||
SiteSetting.allow_moderators_to_create_categories &&
|
SiteSetting.moderators_create_categories &&
|
||||||
is_moderator?
|
is_moderator?
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -14,7 +14,7 @@ module CategoryGuardian
|
||||||
def can_edit_category?(category)
|
def can_edit_category?(category)
|
||||||
is_admin? ||
|
is_admin? ||
|
||||||
(
|
(
|
||||||
SiteSetting.allow_moderators_to_create_categories &&
|
SiteSetting.moderators_create_categories &&
|
||||||
is_moderator? &&
|
is_moderator? &&
|
||||||
can_see_category?(category)
|
can_see_category?(category)
|
||||||
)
|
)
|
||||||
|
|
|
@ -67,7 +67,7 @@ module UserGuardian
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_check_emails?(user)
|
def can_check_emails?(user)
|
||||||
is_admin? || (is_staff? && SiteSetting.show_email_on_profile)
|
is_admin? || (is_staff? && SiteSetting.moderators_view_emails)
|
||||||
end
|
end
|
||||||
|
|
||||||
def restrict_user_fields?(user)
|
def restrict_user_fields?(user)
|
||||||
|
|
|
@ -11,7 +11,9 @@ module SiteSettings::DeprecatedSettings
|
||||||
['apple_touch_icon_url', 'apple_touch_icon', false, '2.3'],
|
['apple_touch_icon_url', 'apple_touch_icon', false, '2.3'],
|
||||||
['default_opengraph_image_url', 'opengraph_image', false, '2.3'],
|
['default_opengraph_image_url', 'opengraph_image', false, '2.3'],
|
||||||
['twitter_summary_large_image_url', 'twitter_summary_large_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
|
def setup_deprecated_methods
|
||||||
|
|
|
@ -41,16 +41,16 @@ describe AdminUserListSerializer do
|
||||||
expect(json[:secondary_emails]).to eq(nil)
|
expect(json[:secondary_emails]).to eq(nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't return emails for a moderator request when show_email_on_profile is disabled" do
|
it "doesn't return emails for a moderator request when moderators_view_emails is disabled" do
|
||||||
SiteSetting.show_email_on_profile = false
|
SiteSetting.moderators_view_emails = false
|
||||||
fabricate_secondary_emails_for(user)
|
fabricate_secondary_emails_for(user)
|
||||||
json = serialize(user, moderator, emails_desired: true)
|
json = serialize(user, moderator, emails_desired: true)
|
||||||
expect(json[:email]).to eq(nil)
|
expect(json[:email]).to eq(nil)
|
||||||
expect(json[:secondary_emails]).to eq(nil)
|
expect(json[:secondary_emails]).to eq(nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns emails for a moderator request when show_email_on_profile is enabled" do
|
it "returns emails for a moderator request when moderators_view_emails is enabled" do
|
||||||
SiteSetting.show_email_on_profile = true
|
SiteSetting.moderators_view_emails = true
|
||||||
fabricate_secondary_emails_for(user)
|
fabricate_secondary_emails_for(user)
|
||||||
json = serialize(user, moderator, emails_desired: true)
|
json = serialize(user, moderator, emails_desired: true)
|
||||||
expect(json[:email]).to eq("user@email.com")
|
expect(json[:email]).to eq("user@email.com")
|
||||||
|
|
Loading…
Reference in New Issue