FIX: Use observer to rerender widget instead.
This commit is contained in:
parent
0984763013
commit
92118dd1d1
|
@ -9,14 +9,11 @@ export default MountWidget.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
@observes('topic.details.notification_level')
|
@observes('topic.details.notification_level')
|
||||||
_triggerEvent() {
|
_queueRerender() {
|
||||||
this.appEvents.trigger('topic-notifications-button:changed', {
|
this.queueRerender();
|
||||||
type: 'notification', id: this.get('topic.details.notification_level')
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super();
|
this._super();
|
||||||
this.dispatch('topic-notifications-button:changed', 'topic-notifications-button');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,6 +38,11 @@ export default MountWidget.extend(Docking, {
|
||||||
this.queueRerender(() => this.queueDockCheck());
|
this.queueRerender(() => this.queueDockCheck());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@observes('topic.details.notification_level')
|
||||||
|
_queueRerender() {
|
||||||
|
this.queueRerender();
|
||||||
|
},
|
||||||
|
|
||||||
dockCheck(info) {
|
dockCheck(info) {
|
||||||
const mainOffset = $('#main').offset();
|
const mainOffset = $('#main').offset();
|
||||||
const offsetTop = mainOffset ? mainOffset.top : 0;
|
const offsetTop = mainOffset ? mainOffset.top : 0;
|
||||||
|
|
|
@ -91,9 +91,7 @@ export default createWidget('topic-notifications-button', {
|
||||||
topicNotificationsButtonChanged(msg) {
|
topicNotificationsButtonChanged(msg) {
|
||||||
switch(msg.type) {
|
switch(msg.type) {
|
||||||
case 'notification':
|
case 'notification':
|
||||||
if (this.attrs.topic.get('details.notification_level') !== msg.id) {
|
this.notificationLevelChanged(msg.id);
|
||||||
this.notificationLevelChanged(msg.id);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue