mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
FIX: Correct the topic notification keyboard shortcuts
This commit is contained in:
parent
a4a53d6500
commit
145ee10f40
3 changed files with 33 additions and 4 deletions
|
@ -11,5 +11,10 @@ export default MountWidget.extend({
|
||||||
@observes('topic.details.notification_level')
|
@observes('topic.details.notification_level')
|
||||||
_triggerRerender() {
|
_triggerRerender() {
|
||||||
this.queueRerender();
|
this.queueRerender();
|
||||||
|
},
|
||||||
|
|
||||||
|
didInsertElement() {
|
||||||
|
this._super();
|
||||||
|
this.dispatch('topic-notifications-button:keyboard-trigger', 'topic-notifications-button');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -32,10 +32,10 @@ const bindings = {
|
||||||
'j': {handler: 'selectDown', anonymous: true},
|
'j': {handler: 'selectDown', anonymous: true},
|
||||||
'k': {handler: 'selectUp', anonymous: true},
|
'k': {handler: 'selectUp', anonymous: true},
|
||||||
'l': {click: '.topic-post.selected button.toggle-like'},
|
'l': {click: '.topic-post.selected button.toggle-like'},
|
||||||
'm m': {click: 'div.notification-options li[data-id="0"] a'}, // mark topic as muted
|
'm m': {handler: 'setTrackingToMuted'}, // mark topic as muted
|
||||||
'm r': {click: 'div.notification-options li[data-id="1"] a'}, // mark topic as regular
|
'm r': {handler: 'setTrackingToRegular'}, // mark topic as regular
|
||||||
'm t': {click: 'div.notification-options li[data-id="2"] a'}, // mark topic as tracking
|
'm t': {handler: 'setTrackingToTracking'}, // mark topic as tracking
|
||||||
'm w': {click: 'div.notification-options li[data-id="3"] a'}, // mark topic as watching
|
'm w': {handler: 'setTrackingToWatching'}, // mark topic as watching
|
||||||
'o,enter': {click: '.topic-list tr.selected a.title', anonymous: true}, // open selected topic
|
'o,enter': {click: '.topic-list tr.selected a.title', anonymous: true}, // open selected topic
|
||||||
'p': {handler: 'showCurrentUser'},
|
'p': {handler: 'showCurrentUser'},
|
||||||
'q': {handler: 'quoteReply'},
|
'q': {handler: 'quoteReply'},
|
||||||
|
@ -179,6 +179,22 @@ export default {
|
||||||
this.container.lookup('controller:application').send('showKeyboardShortcutsHelp');
|
this.container.lookup('controller:application').send('showKeyboardShortcutsHelp');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setTrackingToMuted(event) {
|
||||||
|
this.appEvents.trigger('topic-notifications-button:keyboard-trigger', {type: 'notification', id: 0, event});
|
||||||
|
},
|
||||||
|
|
||||||
|
setTrackingToRegular(event) {
|
||||||
|
this.appEvents.trigger('topic-notifications-button:keyboard-trigger', {type: 'notification', id: 1, event});
|
||||||
|
},
|
||||||
|
|
||||||
|
setTrackingToTracking(event) {
|
||||||
|
this.appEvents.trigger('topic-notifications-button:keyboard-trigger', {type: 'notification', id: 2, event});
|
||||||
|
},
|
||||||
|
|
||||||
|
setTrackingToWatching(event) {
|
||||||
|
this.appEvents.trigger('topic-notifications-button:keyboard-trigger', {type: 'notification', id: 3, event});
|
||||||
|
},
|
||||||
|
|
||||||
sendToTopicListItemView(action) {
|
sendToTopicListItemView(action) {
|
||||||
const elem = $('tr.selected.topic-list-item.ember-view')[0];
|
const elem = $('tr.selected.topic-list-item.ember-view')[0];
|
||||||
if (elem) {
|
if (elem) {
|
||||||
|
|
|
@ -86,5 +86,13 @@ export default createWidget('topic-notifications-button', {
|
||||||
notificationLevelChanged(id) {
|
notificationLevelChanged(id) {
|
||||||
this.state.expanded = false;
|
this.state.expanded = false;
|
||||||
return this.attrs.topic.get('details').updateNotifications(id);
|
return this.attrs.topic.get('details').updateNotifications(id);
|
||||||
|
},
|
||||||
|
|
||||||
|
topicNotificationsButtonKeyboardTrigger(msg) {
|
||||||
|
switch(msg.type) {
|
||||||
|
case 'notification':
|
||||||
|
this.notificationLevelChanged(msg.id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue