rename 'enable_private_messages' to 'enable_personal_messages'

This commit is contained in:
Arpit Jalan 2018-01-31 11:33:12 +05:30
parent 25ec077eca
commit ff0376a80b
13 changed files with 21 additions and 19 deletions

View File

@ -8,12 +8,12 @@ export default Ember.Component.extend({
@computed('topic.isPrivateMessage')
canArchive(isPM) {
return this.siteSettings.enable_private_messages && isPM;
return this.siteSettings.enable_personal_messages && isPM;
},
@computed('topic.isPrivateMessage')
showNotificationsButton(isPM) {
return (!isPM) || this.siteSettings.enable_private_messages;
return (!isPM) || this.siteSettings.enable_personal_messages;
},
@computed('topic.details.can_invite_to')

View File

@ -52,7 +52,7 @@ export default Ember.Controller.extend(CanCheckEmails, {
@computed('viewingSelf', 'currentUser.admin')
showPrivateMessages(viewingSelf, isAdmin) {
return this.siteSettings.enable_private_messages && (viewingSelf || isAdmin);
return this.siteSettings.enable_personal_messages && (viewingSelf || isAdmin);
},
@computed('viewingSelf', 'currentUser.staff')

View File

@ -71,7 +71,7 @@ export default {
let siteSettings = this.container.lookup('site-settings:main');
// Disable the shortcut if private messages are disabled
if (!siteSettings.enable_private_messages) {
if (!siteSettings.enable_personal_messages) {
delete bindings['g m'];
}

View File

@ -40,7 +40,7 @@ createWidget('user-menu-links', {
icon: 'bookmark',
href: `${path}/activity/bookmarks` });
if (siteSettings.enable_private_messages) {
if (siteSettings.enable_personal_messages) {
glyphs.push({ label: 'user.private_messages',
className: 'user-pms-link',
icon: 'envelope',

View File

@ -1036,7 +1036,7 @@ en:
summary_percent_filter: "When a user clicks 'Summarize This Topic', show the top % of posts"
summary_max_results: "Maximum posts returned by 'Summary This Topic'"
enable_private_messages: "Allow trust level 1 (configurable via min trust level to send messages) users to create messages and reply to messages. Note that staff can always send messages no matter what."
enable_personal_messages: "Allow trust level 1 (configurable via min trust level to send messages) users to create messages and reply to messages. Note that staff can always send messages no matter what."
enable_system_message_replies: "Allows users to reply to system messages, even if private messages are disabled"
enable_private_email_messages: "Allow trust level 4 (configurable via min trust level to send messages) users to send private email messages. Note that staff can always send messages no matter what."

View File

@ -505,7 +505,7 @@ posting:
locale_default:
zh_CN: 4
zh_TW: 4
enable_private_messages:
enable_personal_messages:
default: true
client: true
enable_system_message_replies:

View File

@ -7,10 +7,12 @@ class RenamePrivatePersonal < ActiveRecord::Migration[5.1]
def up
setting :min_private_message_post_length, :min_personal_message_post_length
setting :min_private_message_title_length, :min_personal_message_title_length
setting :enable_private_messages, :enable_personal_messages
end
def down
setting :min_private_message_post_length, :min_personal_message_post_length
setting :min_private_message_title_length, :min_personal_message_title_length
setting :enable_private_messages, :enable_personal_messages
end
end

View File

@ -247,7 +247,7 @@ class Guardian
def can_invite_to?(object, groups = nil)
return false unless authenticated?
return true if is_admin?
return false unless SiteSetting.enable_private_messages?
return false unless SiteSetting.enable_personal_messages?
return false if (SiteSetting.max_invites_per_day.to_i == 0 && !is_staff?)
return false unless can_see?(object)
return false if groups.present?
@ -303,7 +303,7 @@ class Guardian
# User disabled private message
(is_staff? || is_group || target.user_option.allow_private_messages) &&
# PMs are enabled
(is_staff? || SiteSetting.enable_private_messages) &&
(is_staff? || SiteSetting.enable_personal_messages) &&
# Can't send PMs to suspended users
(is_staff? || is_group || !target.suspended?) &&
# Check group messageable level

View File

@ -17,7 +17,7 @@ module PostGuardian
result = if authenticated? && post && !@user.anonymous?
return false if [:notify_user, :notify_moderators].include?(action_key) &&
!SiteSetting.enable_private_messages?
!SiteSetting.enable_personal_messages?
# we allow flagging for trust level 1 and higher
# always allowed for private messages

View File

@ -104,7 +104,7 @@ class TopicQuery
# Don't suggest messages unless we have a user, and private messages are
# enabled.
return if topic.private_message? &&
(@user.blank? || !SiteSetting.enable_private_messages?)
(@user.blank? || !SiteSetting.enable_personal_messages?)
builder = SuggestedTopicsBuilder.new(topic)

View File

@ -70,14 +70,14 @@ describe Guardian do
end
it "returns false for notify_user if private messages are disabled" do
SiteSetting.enable_private_messages = false
SiteSetting.enable_personal_messages = false
user.trust_level = TrustLevel[2]
expect(Guardian.new(user).post_can_act?(post, :notify_user)).to be_falsey
expect(Guardian.new(user).post_can_act?(post, :notify_moderators)).to be_falsey
end
it "returns false for notify_user and notify_moderators if private messages are enabled but threshold not met" do
SiteSetting.enable_private_messages = true
SiteSetting.enable_personal_messages = true
SiteSetting.min_trust_to_send_messages = 2
user.trust_level = TrustLevel[1]
expect(Guardian.new(user).post_can_act?(post, :notify_user)).to be_falsey
@ -170,8 +170,8 @@ describe Guardian do
expect(Guardian.new(user).can_send_private_message?(another_user)).to be_falsey
end
context "enable_private_messages is false" do
before { SiteSetting.enable_private_messages = false }
context "enable_personal_messages is false" do
before { SiteSetting.enable_personal_messages = false }
it "returns false if user is not staff member" do
expect(Guardian.new(trust_level_4).can_send_private_message?(another_user)).to be_falsey
@ -451,7 +451,7 @@ describe Guardian do
context "when private messages are disabled" do
before do
SiteSetting.enable_private_messages = false
SiteSetting.enable_personal_messages = false
end
it "doesn't allow a regular user to invite" do

View File

@ -696,7 +696,7 @@ describe TopicQuery do
eq([new_pm.id, unread_pm.id, related_by_user_pm.id])
)
SiteSetting.enable_private_messages = false
SiteSetting.enable_personal_messages = false
expect(TopicQuery.new(user).list_suggested_for(pm_to_group)).to be_blank
expect(TopicQuery.new(user).list_suggested_for(pm_to_user)).to be_blank
end

View File

@ -35,7 +35,7 @@ widgetTest('log out', {
widgetTest('private messages - disabled', {
template: '{{mount-widget widget="user-menu"}}',
beforeEach() {
this.siteSettings.enable_private_messages = false;
this.siteSettings.enable_personal_messages = false;
},
test(assert) {
@ -46,7 +46,7 @@ widgetTest('private messages - disabled', {
widgetTest('private messages - enabled', {
template: '{{mount-widget widget="user-menu"}}',
beforeEach() {
this.siteSettings.enable_private_messages = true;
this.siteSettings.enable_personal_messages = true;
},
test(assert) {