Always refresh notifications

This commit is contained in:
Johannes Zellner
2019-01-08 14:33:47 +01:00
parent 749dd20704
commit db02cbb575

View File

@@ -73,6 +73,10 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
function refreshNotifications() { function refreshNotifications() {
Client.getNotifications(false, 1, 20, function (error, results) { Client.getNotifications(false, 1, 20, function (error, results) {
$timeout(refreshNotifications, 10000);
if (error) return console.error(error);
var newNotifications = results.filter(function (a) { var newNotifications = results.filter(function (a) {
return !$scope.notifications.find(function (b) { return !$scope.notifications.find(function (b) {
return a.id === b.id; return a.id === b.id;
@@ -84,7 +88,6 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
Client.notify(n.title, n.message, false, 'info', n.action); Client.notify(n.title, n.message, false, 'info', n.action);
}); });
$timeout(refreshNotifications, 10000);
}); });
} }