diff --git a/src/views/notifications.js b/src/views/notifications.js index 9a27b6e2f..c3d85ea09 100644 --- a/src/views/notifications.js +++ b/src/views/notifications.js @@ -3,7 +3,7 @@ /* global async */ /* global angular */ -angular.module('Application').controller('NotificationsController', ['$scope', '$timeout', '$translate', 'Client', function ($scope, $timeout, $translate, Client) { +angular.module('Application').controller('NotificationsController', ['$scope', '$timeout', '$translate', '$interval', 'Client', function ($scope, $timeout, $translate, $interval, Client) { $scope.clearAllBusy = false; $scope.notifications = []; @@ -22,13 +22,9 @@ angular.module('Application').controller('NotificationsController', ['$scope', ' // attempt to translate or parse the message as json result.forEach(function (r) { - if (r.message.slice(0, 3) === 'tr:') { - r.message = $translate.instant(r.message.slice(3)); - } else { - try { - r.messageJson = JSON.parse(r.message); - } catch (e) {} - } + try { + r.messageJson = JSON.parse(r.message); + } catch (e) {} }); $scope.notifications = result; @@ -88,6 +84,10 @@ angular.module('Application').controller('NotificationsController', ['$scope', ' }; Client.onReady(function () { + var refreshTimer = $interval($scope.refresh, 60 * 1000); // keep this interval in sync with the notification count indicator in main.js + $scope.$on('$destroy', function () { + $interval.cancel(refreshTimer); + }); $scope.refresh(); }); }]);