Improve notification click redirect

stable
Daniel García 2018-11-26 13:48:39 +01:00 committed by Alex Hermida
parent 0f0ef0c983
commit 254e7384cb
1 changed files with 4 additions and 4 deletions

View File

@ -42,7 +42,8 @@ class NotificationsController extends mixOf(taiga.Controller, taiga.PageMixin, t
@.loadNotifications() @.loadNotifications()
@rootScope.$on "notifications:updated", (event) => @rootScope.$on "notifications:updated", (event) =>
@.reloadList() if @.onlyUnread
@.reloadList()
initList: ()-> initList: ()->
@.notificationsList = Immutable.List() @.notificationsList = Immutable.List()
@ -73,15 +74,14 @@ class NotificationsController extends mixOf(taiga.Controller, taiga.PageMixin, t
return @.notificationsList return @.notificationsList
setAsRead: (notification, url) -> setAsRead: (notification, url) ->
@.loading = true
@scope.$emit("notifications:loading")
@notificationsService.setNotificationAsRead(notification.get("id")).then => @notificationsService.setNotificationAsRead(notification.get("id")).then =>
if @location.$$url == url if @location.$$url == url
@window.location.reload() @window.location.reload()
else else
@rootScope.$broadcast "notifications:updated"
@location.path(url) @location.path(url)
@rootScope.$broadcast "notifications:updated"
setAllAsRead: () -> setAllAsRead: () ->
@.loading = true @.loading = true
@scope.$emit("notifications:loading") @scope.$emit("notifications:loading")