We don't allow setting notifications to unread anymore so also prevent state issues when decreasing the counter

This commit is contained in:
Johannes Zellner
2021-06-30 17:24:41 +02:00
parent 7c15c26fa9
commit 59f257346d
3 changed files with 10 additions and 14 deletions
+1 -4
View File
@@ -25,10 +25,7 @@
<div class="row">
<div class="col-xs-12" ng-click="notification.isCollapsed = !notification.isCollapsed" ng-class="{ 'notification-details': notification.detailsShown }">
<span ng-class="{'text-bold': !notification.acknowledged }">{{ notification.title }}</span> <small class="text-muted" uib-tooltip="{{ notification.creationTime | prettyLongDate }}">{{ notification.creationTime | prettyDate }}</small>
<!-- hidden for now since it seems overkill to have "unread" -->
<!-- <button class="btn btn-xs btn-default pull-right" ng-show="notification.acknowledged" ng-click="ack(notification, false, $event)" uib-tooltip="{{ 'notifications.dismissTooltip' | tr }}"><i class="fa fa-asterisk"></i></button> -->
<div uib-collapse="notification.isCollapsed" expanding="ack(notification, true)">
<div uib-collapse="notification.isCollapsed" expanding="ack(notification)">
<br/>
<p ng-hide="notification.messageJson" ng-click="$event.stopPropagation();" style="cursor: auto; overflow: auto;" ng-bind-html="notification.message | markdown2html"></p>
<pre ng-show="notification.messageJson" ng-click="$event.stopPropagation();" style="cursor: auto">{{ notification.messageJson | json }}</pre>
+6 -8
View File
@@ -46,16 +46,14 @@ angular.module('Application').controller('NotificationsController', ['$scope', '
$scope.refresh();
};
$scope.ack = function (notification, acked, event) {
if (event) event.stopPropagation();
$scope.ack = function (notification) {
if (notification.acknowledged) return;
if (notification.acknowledged === acked) return;
Client.ackNotification(notification.id, acked, function (error) {
Client.ackNotification(notification.id, true, function (error) {
if (error) console.error(error);
notification.acknowledged = acked;
$scope.$parent.notificationAcknowledged(acked);
notification.acknowledged = true;
$scope.$parent.notificationAcknowledged();
});
};
@@ -70,7 +68,7 @@ angular.module('Application').controller('NotificationsController', ['$scope', '
console.error(error);
} else {
notification.acknowledged = true;
$scope.$parent.notificationAcknowledged(true);
$scope.$parent.notificationAcknowledged();
}
callback();