FIX: broken spec

This commit is contained in:
Joffrey JAFFEUX 2017-09-07 19:18:27 +02:00
parent 657440b8be
commit 5054065e81
2 changed files with 9 additions and 4 deletions

View File

@ -25,7 +25,9 @@ export default DropdownSelectBoxComponent.extend({
_bindGlobalLevelChanged() { _bindGlobalLevelChanged() {
this.appEvents.on("topic-notifications-button:changed", (msg) => { this.appEvents.on("topic-notifications-button:changed", (msg) => {
if (msg.type === "notification") { if (msg.type === "notification") {
this.set("value", msg.id); if (this.get("topic.details.notification_level") !== msg.id) {
this.get("topic.details").updateNotifications(msg.id);
}
} }
}); });
}, },
@ -37,7 +39,6 @@ export default DropdownSelectBoxComponent.extend({
@observes("value") @observes("value")
_notificationLevelChanged() { _notificationLevelChanged() {
this.get("topic.details").updateNotifications(this.get("value"));
this.appEvents.trigger('topic-notifications-button:changed', {type: 'notification', id: this.get("value")}); this.appEvents.trigger('topic-notifications-button:changed', {type: 'notification', id: this.get("value")});
}, },
@ -47,6 +48,11 @@ export default DropdownSelectBoxComponent.extend({
return iconHTML(details.icon, {class: details.key}).htmlSafe(); return iconHTML(details.icon, {class: details.key}).htmlSafe();
}, },
@observes("topic.details.notification_level")
_content() {
this.set("value", this.get("topic.details.notification_level"));
},
@computed("topic.details.notification_level", "showFullTitle") @computed("topic.details.notification_level", "showFullTitle")
generatedHeadertext(notificationLevel, showFullTitle) { generatedHeadertext(notificationLevel, showFullTitle) {
if (showFullTitle) { if (showFullTitle) {
@ -75,5 +81,5 @@ export default DropdownSelectBoxComponent.extend({
</div> </div>
`; `;
}; };
}.property(), }.property()
}); });

View File

@ -84,6 +84,5 @@ export default MountWidget.extend(Docking, {
} }
this.dispatch('topic:current-post-scrolled', 'timeline-scrollarea'); this.dispatch('topic:current-post-scrolled', 'timeline-scrollarea');
this.dispatch('topic-notifications-button:changed', 'topic-notifications-button');
} }
}); });