FIX: Changing notification level in topic footer buttons was not updating timeline.
This commit is contained in:
parent
7cb389a235
commit
5cb64810cd
|
@ -9,12 +9,14 @@ export default MountWidget.extend({
|
|||
},
|
||||
|
||||
@observes('topic.details.notification_level')
|
||||
_triggerRerender() {
|
||||
this.queueRerender();
|
||||
_triggerEvent() {
|
||||
this.appEvents.trigger('topic-notifications-button:changed', {
|
||||
type: 'notification', id: this.get('topic.details.notification_level')
|
||||
});
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
this._super();
|
||||
this.dispatch('topic-notifications-button:keyboard-trigger', 'topic-notifications-button');
|
||||
this.dispatch('topic-notifications-button:changed', 'topic-notifications-button');
|
||||
}
|
||||
});
|
||||
|
|
|
@ -79,6 +79,6 @@ export default MountWidget.extend(Docking, {
|
|||
}
|
||||
|
||||
this.dispatch('topic:current-post-scrolled', 'timeline-scrollarea');
|
||||
this.dispatch('topic-notifications-button:keyboard-trigger', 'topic-notifications-button');
|
||||
this.dispatch('topic-notifications-button:changed', 'topic-notifications-button');
|
||||
}
|
||||
});
|
||||
|
|
|
@ -196,19 +196,19 @@ export default {
|
|||
},
|
||||
|
||||
setTrackingToMuted(event) {
|
||||
this.appEvents.trigger('topic-notifications-button:keyboard-trigger', {type: 'notification', id: 0, event});
|
||||
this.appEvents.trigger('topic-notifications-button:changed', {type: 'notification', id: 0, event});
|
||||
},
|
||||
|
||||
setTrackingToRegular(event) {
|
||||
this.appEvents.trigger('topic-notifications-button:keyboard-trigger', {type: 'notification', id: 1, event});
|
||||
this.appEvents.trigger('topic-notifications-button:changed', {type: 'notification', id: 1, event});
|
||||
},
|
||||
|
||||
setTrackingToTracking(event) {
|
||||
this.appEvents.trigger('topic-notifications-button:keyboard-trigger', {type: 'notification', id: 2, event});
|
||||
this.appEvents.trigger('topic-notifications-button:changed', {type: 'notification', id: 2, event});
|
||||
},
|
||||
|
||||
setTrackingToWatching(event) {
|
||||
this.appEvents.trigger('topic-notifications-button:keyboard-trigger', {type: 'notification', id: 3, event});
|
||||
this.appEvents.trigger('topic-notifications-button:changed', {type: 'notification', id: 3, event});
|
||||
},
|
||||
|
||||
sendToTopicListItemView(action) {
|
||||
|
|
|
@ -88,7 +88,7 @@ export default createWidget('topic-notifications-button', {
|
|||
return this.attrs.topic.get('details').updateNotifications(id);
|
||||
},
|
||||
|
||||
topicNotificationsButtonKeyboardTrigger(msg) {
|
||||
topicNotificationsButtonChanged(msg) {
|
||||
switch(msg.type) {
|
||||
case 'notification':
|
||||
this.notificationLevelChanged(msg.id);
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Topic Notifications button", {
|
||||
loggedIn: true,
|
||||
setup() {
|
||||
const response = object => {
|
||||
return [
|
||||
200,
|
||||
{ "Content-Type": "application/json" },
|
||||
object
|
||||
];
|
||||
};
|
||||
|
||||
server.post('/t/280/notifications', () => { // eslint-disable-line no-undef
|
||||
return response({});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
test("Share Popup", () => {
|
||||
visit("/t/internationalization-localization/280");
|
||||
|
||||
const notificationOptions = "#topic-footer-buttons .notification-options";
|
||||
|
||||
andThen(() => {
|
||||
ok(
|
||||
exists(`${notificationOptions} .tracking`),
|
||||
"it should display the notification options button in the topic's footer"
|
||||
);
|
||||
});
|
||||
|
||||
click(`${notificationOptions} .tracking`);
|
||||
click(`${notificationOptions} .dropdown-menu .watching`);
|
||||
|
||||
andThen(() => {
|
||||
ok(
|
||||
exists(`${notificationOptions} .watching`),
|
||||
"it should display the right notification level"
|
||||
);
|
||||
|
||||
ok(
|
||||
exists(".timeline-footer-controls .notification-options .watching"),
|
||||
'it should display the right notification level in topic timeline'
|
||||
);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue