mirror of
https://github.com/discourse/discourse.git
synced 2024-12-05 10:36:30 +08:00
41 lines
913 B
JavaScript
41 lines
913 B
JavaScript
import Component from "@ember/component";
|
|
|
|
export default Component.extend({
|
|
layoutName: "select-kit/templates/components/topic-notifications-button",
|
|
classNames: ["topic-notifications-button"],
|
|
appendReason: 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: {
|
|
changeTopicNotificationLevel(level, notification) {
|
|
this._changeTopicNotificationLevel(notification);
|
|
}
|
|
}
|
|
});
|