FIX: Use observer to rerender widget instead.

This commit is contained in:
Guo Xiang Tan 2017-05-17 10:29:18 +08:00
parent 0984763013
commit 92118dd1d1
3 changed files with 8 additions and 8 deletions

View File

@ -9,14 +9,11 @@ export default MountWidget.extend({
},
@observes('topic.details.notification_level')
_triggerEvent() {
this.appEvents.trigger('topic-notifications-button:changed', {
type: 'notification', id: this.get('topic.details.notification_level')
});
_queueRerender() {
this.queueRerender();
},
didInsertElement() {
this._super();
this.dispatch('topic-notifications-button:changed', 'topic-notifications-button');
}
});

View File

@ -38,6 +38,11 @@ export default MountWidget.extend(Docking, {
this.queueRerender(() => this.queueDockCheck());
},
@observes('topic.details.notification_level')
_queueRerender() {
this.queueRerender();
},
dockCheck(info) {
const mainOffset = $('#main').offset();
const offsetTop = mainOffset ? mainOffset.top : 0;

View File

@ -91,9 +91,7 @@ export default createWidget('topic-notifications-button', {
topicNotificationsButtonChanged(msg) {
switch(msg.type) {
case 'notification':
if (this.attrs.topic.get('details.notification_level') !== msg.id) {
this.notificationLevelChanged(msg.id);
}
this.notificationLevelChanged(msg.id);
break;
}
}