mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: ensure 'notifications_state' is up to date after creating a notification
This commit is contained in:
@@ -16,7 +16,7 @@ const SiteHeaderComponent = MountWidget.extend(Docking, {
|
||||
_topic: null,
|
||||
|
||||
@observes('currentUser.unread_notifications', 'currentUser.unread_private_messages')
|
||||
_notificationsChanged() {
|
||||
notificationsChanged() {
|
||||
this.queueRerender();
|
||||
},
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ export default {
|
||||
|
||||
bus.subscribe(`/notification/${user.get('id')}`, data => {
|
||||
const store = container.lookup('service:store');
|
||||
|
||||
const oldUnread = user.get('unread_notifications');
|
||||
const oldPM = user.get('unread_private_messages');
|
||||
|
||||
@@ -66,7 +65,7 @@ export default {
|
||||
oldNotifications.insertAt(insertPosition, Em.Object.create(lastNotification));
|
||||
}
|
||||
|
||||
for (let idx=0; idx < data.recent.length; idx++) {
|
||||
for (let idx = 0; idx < data.recent.length; idx++) {
|
||||
let old;
|
||||
while(old = oldNotifications[idx]) {
|
||||
const info = data.recent[idx];
|
||||
@@ -96,21 +95,16 @@ export default {
|
||||
});
|
||||
|
||||
bus.subscribe("/client_settings", data => Ember.set(siteSettings, data.name, data.value));
|
||||
|
||||
bus.subscribe("/refresh_client", data => {
|
||||
Discourse.set("assetVersion", data);
|
||||
});
|
||||
bus.subscribe("/refresh_client", data => Discourse.set("assetVersion", data));
|
||||
|
||||
if (!Ember.testing) {
|
||||
|
||||
bus.subscribe(alertChannel(user), data => onNotification(data, user));
|
||||
initDesktopNotifications(bus, appEvents);
|
||||
|
||||
if(isPushNotificationsEnabled(user, site.mobileView)) {
|
||||
if (isPushNotificationsEnabled(user, site.mobileView)) {
|
||||
disableDesktopNotifications();
|
||||
registerPushNotifications(Discourse.User.current(), site.mobileView, router, appEvents);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
unsubscribePushNotifications(user);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user