Repair notifications sync
parent
0bd3b38a26
commit
09855054be
|
@ -121,7 +121,7 @@ class EventsService
|
|||
routingKey = "web_notifications.#{userId}"
|
||||
randomTimeout = taiga.randomInt(700, 1000)
|
||||
@.subscribe null, routingKey, (data) =>
|
||||
@rootScope.$broadcast "notifications:updated"
|
||||
@rootScope.$broadcast "notifications:new"
|
||||
|
||||
###########################################
|
||||
# Heartbeat (Ping - Pong)
|
||||
|
|
|
@ -41,7 +41,7 @@ DropdownNotificationsDirective = ($rootScope, notificationsService, currentUserS
|
|||
|
||||
$scope.setAllAsRead = () ->
|
||||
notificationsService.setNotificationsAsRead().then ->
|
||||
$rootScope.$emit("notifications:updated")
|
||||
$rootScope.$emit("notifications:dismiss-all")
|
||||
|
||||
directive = {
|
||||
templateUrl: "navigation-bar/dropdown-notifications/dropdown-notifications.html"
|
||||
|
|
|
@ -41,10 +41,16 @@ class NotificationsController extends mixOf(taiga.Controller, taiga.PageMixin, t
|
|||
@.initList()
|
||||
@.loadNotifications()
|
||||
|
||||
@rootScope.$on "notifications:updated", (event) =>
|
||||
@rootScope.$on "notifications:dismiss", (event) =>
|
||||
if @.onlyUnread
|
||||
@.reloadList()
|
||||
|
||||
@rootScope.$on "notifications:new", (event) =>
|
||||
@.reloadList()
|
||||
|
||||
@rootScope.$on "notifications:dismiss-all", (event) =>
|
||||
@.reloadList()
|
||||
|
||||
initList: ()->
|
||||
@.notificationsList = Immutable.List()
|
||||
@.list = @notificationsService.getNotificationsList(@.user.get("id"), @.onlyUnread?)
|
||||
|
@ -80,13 +86,11 @@ class NotificationsController extends mixOf(taiga.Controller, taiga.PageMixin, t
|
|||
else
|
||||
@location.path(url)
|
||||
|
||||
@rootScope.$broadcast "notifications:updated"
|
||||
@rootScope.$broadcast "notifications:dismiss"
|
||||
|
||||
setAllAsRead: () ->
|
||||
@.loading = true
|
||||
@scope.$emit("notifications:loading")
|
||||
@notificationsService.setNotificationsAsRead().then =>
|
||||
@rootScope.$emit("notifications:updated")
|
||||
@rootScope.$broadcast "notifications:dismiss-all"
|
||||
|
||||
|
||||
angular.module("taigaNotifications").controller("Notifications", NotificationsController)
|
||||
|
|
Loading…
Reference in New Issue