mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 00:53:39 +08:00
Merge pull request #4274 from cpradio/fix-keyboard-shortcuts
FIX: Correct the topic notification keyboard shortcuts
This commit is contained in:
commit
c9de667a83
|
@ -11,5 +11,10 @@ export default MountWidget.extend({
|
|||
@observes('topic.details.notification_level')
|
||||
_triggerRerender() {
|
||||
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},
|
||||
'k': {handler: 'selectUp', anonymous: true},
|
||||
'l': {click: '.topic-post.selected button.toggle-like'},
|
||||
'm m': {click: 'div.notification-options li[data-id="0"] a'}, // mark topic as muted
|
||||
'm r': {click: 'div.notification-options li[data-id="1"] a'}, // mark topic as regular
|
||||
'm t': {click: 'div.notification-options li[data-id="2"] a'}, // mark topic as tracking
|
||||
'm w': {click: 'div.notification-options li[data-id="3"] a'}, // mark topic as watching
|
||||
'm m': {handler: 'setTrackingToMuted'}, // mark topic as muted
|
||||
'm r': {handler: 'setTrackingToRegular'}, // mark topic as regular
|
||||
'm t': {handler: 'setTrackingToTracking'}, // mark topic as tracking
|
||||
'm w': {handler: 'setTrackingToWatching'}, // mark topic as watching
|
||||
'o,enter': {click: '.topic-list tr.selected a.title', anonymous: true}, // open selected topic
|
||||
'p': {handler: 'showCurrentUser'},
|
||||
'q': {handler: 'quoteReply'},
|
||||
|
@ -179,6 +179,22 @@ export default {
|
|||
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) {
|
||||
const elem = $('tr.selected.topic-list-item.ember-view')[0];
|
||||
if (elem) {
|
||||
|
|
|
@ -86,5 +86,13 @@ export default createWidget('topic-notifications-button', {
|
|||
notificationLevelChanged(id) {
|
||||
this.state.expanded = false;
|
||||
return this.attrs.topic.get('details').updateNotifications(id);
|
||||
},
|
||||
|
||||
topicNotificationsButtonKeyboardTrigger(msg) {
|
||||
switch(msg.type) {
|
||||
case 'notification':
|
||||
this.notificationLevelChanged(msg.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user