A platform for community discussion. Free, open, simple.
FIX: ensures shortcuts work correctly with topic-notifications-button (#8956)
Joffrey JAFFEUX3875785dccae
diff --git a/app/assets/javascripts/select-kit/components/topic-notifications-button.js.es6 b/app/assets/javascripts/select-kit/components/topic-notifications-button.js.es6index efca6b77c8a..3ed6530b917 100644--- a/app/assets/javascripts/select-kit/components/topic-notifications-button.js.es6+++ b/app/assets/javascripts/select-kit/components/topic-notifications-button.js.es6@@ -6,11 +6,35 @@ export default Component.extend({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(newNotificationLevel) {- if (newNotificationLevel !== this.notificationLevel) {- this.topic.details.updateNotifications(newNotificationLevel);- }+ changeTopicNotificationLevel(level, notification) {+ this._changeTopicNotificationLevel(notification);}}});diff --git a/app/assets/javascripts/select-kit/components/topic-notifications-options.js.es6 b/app/assets/javascripts/select-kit/components/topic-notifications-options.js.es6index a1f98fa6b57..ae3dd483175 100644--- a/app/assets/javascripts/select-kit/components/topic-notifications-options.js.es6+++ b/app/assets/javascripts/select-kit/components/topic-notifications-options.js.es6@@ -16,17 +16,5 @@ export default NotificationsButtonComponent.extend({i18nPostfix: computed("topic.archetype", function() {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");- }+ })});