2020-02-03 21:22:14 +08:00
|
|
|
import NotificationsButtonComponent from "select-kit/components/notifications-button";
|
2017-10-20 03:51:08 +08:00
|
|
|
import { topicLevels } from "discourse/lib/notification-levels";
|
2020-02-03 21:22:14 +08:00
|
|
|
import { computed } from "@ember/object";
|
2017-10-20 03:51:08 +08:00
|
|
|
|
2020-02-03 21:22:14 +08:00
|
|
|
export default NotificationsButtonComponent.extend({
|
2017-11-21 18:53:09 +08:00
|
|
|
pluginApiIdentifiers: ["topic-notifications-options"],
|
2020-02-03 21:22:14 +08:00
|
|
|
classNames: ["topic-notifications-options"],
|
2017-10-20 03:51:08 +08:00
|
|
|
content: topicLevels,
|
|
|
|
|
2020-02-03 21:22:14 +08:00
|
|
|
selectKitOptions: {
|
|
|
|
i18nPrefix: "i18nPrefix",
|
|
|
|
i18nPostfix: "i18nPostfix"
|
2018-06-11 17:35:13 +08:00
|
|
|
},
|
|
|
|
|
2020-02-03 21:22:14 +08:00
|
|
|
i18nPrefix: "topic.notifications",
|
2019-03-20 19:50:13 +08:00
|
|
|
|
2020-02-03 21:22:14 +08:00
|
|
|
i18nPostfix: computed("topic.archetype", function() {
|
|
|
|
return this.topic.archetype === "private_message" ? "_pm" : "";
|
|
|
|
}),
|
2017-10-20 03:51:08 +08:00
|
|
|
|
2020-02-03 21:22:14 +08:00
|
|
|
didInsertElement() {
|
|
|
|
this._super(...arguments);
|
2017-10-20 03:51:08 +08:00
|
|
|
|
2020-02-03 21:22:14 +08:00
|
|
|
this.appEvents.on("topic-notifications-button:changed", this, "onSelect");
|
2019-03-26 19:04:33 +08:00
|
|
|
},
|
|
|
|
|
2020-02-03 21:22:14 +08:00
|
|
|
willDestroyElement() {
|
|
|
|
this._super(...arguments);
|
|
|
|
|
|
|
|
this.appEvents.off("topic-notifications-button:changed", this, "onSelect");
|
|
|
|
}
|
2017-10-20 03:51:08 +08:00
|
|
|
});
|