NotificationStore.__onDispatch = function (payload) { switch (payload.actionType) { case notificationConstants.CHECKED_NOTIFICATION_IDS_RECEIVED: NotificationStore.markNotificationsChecked(payload.checked_ids); NotificationStore.__emitChange(); break; case notificationConstants.NOTIFICATIONS_RECEIVED: if (payload.notifications.length === 0) { _nomore = true } if (_notifications[0] && _notifications[0].notified_id !== SessionStore.currentUser().id) { NotificationStore.setNotifications(payload.notifications); } else { NotificationStore.addNotifications(payload.notifications); } NotificationStore.__emitChange(); break; case socketConstants.PUSH_NOTIFICATION: NotificationStore.addNewNotification(payload.notification); NotificationStore.__emitChange(); break; case notificationConstants.READ_NOTIFICATION_ID_RECEIVED: NotificationStore.markNotificationRead(payload.id); NotificationStore.__emitChange(); break; } };