FIX: Disable the keyboard shortcut if private messages are disabled

This commit is contained in:
Robin Ward 2018-01-22 16:45:27 -05:00
parent a9e0c6a685
commit e52e0f4635
2 changed files with 9 additions and 1 deletions

View File

@ -68,6 +68,12 @@ export default {
this.searchService = this.container.lookup('search-service:main'); this.searchService = this.container.lookup('search-service:main');
this.appEvents = this.container.lookup('app-events:main'); this.appEvents = this.container.lookup('app-events:main');
this.currentUser = this.container.lookup('current-user:main'); this.currentUser = this.container.lookup('current-user:main');
let siteSettings = this.container.lookup('site-settings:main');
// Disable the shortcut if private messages are disabled
if (!siteSettings.enable_private_messages) {
delete bindings['g m'];
}
Object.keys(bindings).forEach(key => { Object.keys(bindings).forEach(key => {
const binding = bindings[key]; const binding = bindings[key];

View File

@ -11,7 +11,9 @@
<li>{{{i18n 'keyboard_shortcuts_help.jump_to.top'}}}</li> <li>{{{i18n 'keyboard_shortcuts_help.jump_to.top'}}}</li>
<li>{{{i18n 'keyboard_shortcuts_help.jump_to.bookmarks'}}}</li> <li>{{{i18n 'keyboard_shortcuts_help.jump_to.bookmarks'}}}</li>
<li>{{{i18n 'keyboard_shortcuts_help.jump_to.profile'}}}</li> <li>{{{i18n 'keyboard_shortcuts_help.jump_to.profile'}}}</li>
<li>{{{i18n 'keyboard_shortcuts_help.jump_to.messages'}}}</li> {{#if siteSettings.enable_private_messages}}
<li>{{{i18n 'keyboard_shortcuts_help.jump_to.messages'}}}</li>
{{/if}}
</ul> </ul>
<h4>{{i18n 'keyboard_shortcuts_help.navigation.title'}}</h4> <h4>{{i18n 'keyboard_shortcuts_help.navigation.title'}}</h4>
<ul> <ul>