2019-10-24 00:30:52 +08:00
|
|
|
import Component from "@ember/component";
|
2020-02-03 21:22:14 +08:00
|
|
|
|
2019-10-24 00:30:52 +08:00
|
|
|
export default Component.extend({
|
2017-11-21 18:53:09 +08:00
|
|
|
layoutName: "select-kit/templates/components/topic-notifications-button",
|
2020-02-03 21:22:14 +08:00
|
|
|
classNames: ["topic-notifications-button"],
|
|
|
|
appendReason: true,
|
2017-10-20 03:51:08 +08:00
|
|
|
showFullTitle: true,
|
2020-02-03 21:22:14 +08:00
|
|
|
|
2020-02-13 17:01:28 +08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-02-03 21:22:14 +08:00
|
|
|
actions: {
|
2020-02-13 17:01:28 +08:00
|
|
|
changeTopicNotificationLevel(level, notification) {
|
|
|
|
this._changeTopicNotificationLevel(notification);
|
2020-02-03 21:22:14 +08:00
|
|
|
}
|
|
|
|
}
|
2017-10-20 03:51:08 +08:00
|
|
|
});
|