FIX: ensures shortcuts work correctly with topic-notifications-button (#8956)
This commit is contained in:
parent
42bda52486
commit
3875785dcc
|
@ -6,11 +6,35 @@ export default Component.extend({
|
||||||
appendReason: true,
|
appendReason: true,
|
||||||
showFullTitle: true,
|
showFullTitle: true,
|
||||||
|
|
||||||
|
didInsertElement() {
|
||||||
|
this._super(...arguments);
|
||||||
|
|
||||||
|
this.appEvents.on(
|
||||||
|
"topic-notifications-button:changed",
|
||||||
|
this,
|
||||||
|
"_changeTopicNotificationLevel"
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
willDestroyElement() {
|
||||||
|
this._super(...arguments);
|
||||||
|
|
||||||
|
this.appEvents.off(
|
||||||
|
"topic-notifications-button:changed",
|
||||||
|
this,
|
||||||
|
"_changeTopicNotificationLevel"
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
_changeTopicNotificationLevel(level) {
|
||||||
|
if (level.id !== this.notificationLevel) {
|
||||||
|
this.topic.details.updateNotifications(level.id);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
changeTopicNotificationLevel(newNotificationLevel) {
|
changeTopicNotificationLevel(level, notification) {
|
||||||
if (newNotificationLevel !== this.notificationLevel) {
|
this._changeTopicNotificationLevel(notification);
|
||||||
this.topic.details.updateNotifications(newNotificationLevel);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,17 +16,5 @@ export default NotificationsButtonComponent.extend({
|
||||||
|
|
||||||
i18nPostfix: computed("topic.archetype", function() {
|
i18nPostfix: computed("topic.archetype", function() {
|
||||||
return this.topic.archetype === "private_message" ? "_pm" : "";
|
return this.topic.archetype === "private_message" ? "_pm" : "";
|
||||||
}),
|
})
|
||||||
|
|
||||||
didInsertElement() {
|
|
||||||
this._super(...arguments);
|
|
||||||
|
|
||||||
this.appEvents.on("topic-notifications-button:changed", this, "onSelect");
|
|
||||||
},
|
|
||||||
|
|
||||||
willDestroyElement() {
|
|
||||||
this._super(...arguments);
|
|
||||||
|
|
||||||
this.appEvents.off("topic-notifications-button:changed", this, "onSelect");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue