From d3666d3468db97004396aa5d6c7860fdca4bb45b Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 8 Sep 2015 16:32:20 -0400 Subject: [PATCH] FIX: If private messages are disabled don't show the menu link --- app/assets/javascripts/discourse/controllers/user.js.es6 | 6 +++++- .../discourse/templates/components/user-menu.hbs | 5 ++++- config/site_settings.yml | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/user.js.es6 b/app/assets/javascripts/discourse/controllers/user.js.es6 index 757779abec8..83c7c4ec99a 100644 --- a/app/assets/javascripts/discourse/controllers/user.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user.js.es6 @@ -23,7 +23,11 @@ export default Ember.Controller.extend(CanCheckEmails, { return this.get('model.trust_level') > 2 && !this.siteSettings.tl3_links_no_follow; }.property('model.trust_level'), - canSeePrivateMessages: Ember.computed.or('viewingSelf', 'currentUser.admin'), + @computed('viewSelf', 'currentUser.admin') + canSeePrivateMessages(viewingSelf, isAdmin) { + return this.siteSettings.enable_private_messages && (viewingSelf || isAdmin); + }, + canSeeNotificationHistory: Em.computed.alias('canSeePrivateMessages'), showBadges: function() { diff --git a/app/assets/javascripts/discourse/templates/components/user-menu.hbs b/app/assets/javascripts/discourse/templates/components/user-menu.hbs index fa0b578e64a..bba85df8d94 100644 --- a/app/assets/javascripts/discourse/templates/components/user-menu.hbs +++ b/app/assets/javascripts/discourse/templates/components/user-menu.hbs @@ -8,7 +8,10 @@ {{/if}}
  • {{d-link path=bookmarksPath title="user.bookmarks" icon="bookmark"}} - {{d-link path=messagesPath title="user.private_messages" icon="envelope"}} + {{log siteSettings}} + {{#if siteSettings.enable_private_messages}} + {{d-link path=messagesPath title="user.private_messages" icon="envelope"}} + {{/if}} {{#if showEnableAnon}} {{d-link action="toggleAnon" title="switch_to_anon" icon="user-secret"}} {{/if}} diff --git a/config/site_settings.yml b/config/site_settings.yml index 78f4b7b1416..754e067b827 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -374,7 +374,9 @@ posting: min_body_similar_length: client: true default: 15 - enable_private_messages: true + enable_private_messages: + default: true + client: true ninja_edit_window: 300 post_edit_time_limit: 86400 edit_history_visible_to_public: