mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 17:53:45 +08:00
42 lines
942 B
JavaScript
42 lines
942 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,
|
|
placement: "bottom-start",
|
|
|
|
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);
|
|
}
|
|
}
|
|
});
|