Skip already acknowledged notifications on clear

This commit is contained in:
Johannes Zellner
2019-01-09 17:36:33 +01:00
parent a879bdeb47
commit 182949d8d2
2 changed files with 6 additions and 3 deletions

View File

@@ -5,6 +5,8 @@
angular.module('Application').controller('NotificationsController', ['$scope', 'Client', function ($scope, Client) {
$scope.clearAllBusy = false;
$scope.notifications = {
notifications: [],
activeNotification: null,
@@ -54,14 +56,15 @@ angular.module('Application').controller('NotificationsController', ['$scope', '
},
clearAll: function () {
$scope.notifications.busy = true;
$scope.clearAllBusy = true;
asyncForEach($scope.notifications.notifications, function (notification, callback) {
if (notification.acknowledged) return callback();
$scope.notifications.ack(notification, callback);
}, function (error) {
if (error) console.error(error);
$scope.notifications.busy = false;
$scope.clearAllBusy = false;
});
}
};