List unread notifications in accounts view
This commit is contained in:
@@ -12,6 +12,7 @@ angular.module('Application').controller('AccountController', ['$scope', 'Client
|
||||
$scope.activeClients = [];
|
||||
$scope.webadminClient = {};
|
||||
$scope.apiClient = {};
|
||||
$scope.notifications = [];
|
||||
|
||||
$scope.twoFactorAuthentication = {
|
||||
busy: false,
|
||||
@@ -381,6 +382,23 @@ angular.module('Application').controller('AccountController', ['$scope', 'Client
|
||||
});
|
||||
}
|
||||
|
||||
function refreshNotifications() {
|
||||
Client.getNotifications(false, 1, 100, function (error, result) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
$scope.notifications = result;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.notificationClicked = function (notification) {
|
||||
Client.ackNotification(notification.id, function (error) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
if (notification.action) window.location = notification.action;
|
||||
else refreshNotifications();
|
||||
});
|
||||
};
|
||||
|
||||
Client.onReady(function () {
|
||||
Client.getOAuthClients(function (error, activeClients) {
|
||||
if (error) return console.error(error);
|
||||
@@ -397,6 +415,8 @@ angular.module('Application').controller('AccountController', ['$scope', 'Client
|
||||
$scope.activeTokenCount += $scope.webadminClient ? $scope.webadminClient.activeTokens.length : 0;
|
||||
});
|
||||
});
|
||||
|
||||
refreshNotifications();
|
||||
});
|
||||
|
||||
// setup all the dialog focus handling
|
||||
|
||||
Reference in New Issue
Block a user