notifications: per user email prefs
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
/* global async */
|
||||
/* global angular */
|
||||
/* global angular, $ */
|
||||
|
||||
angular.module('Application').controller('NotificationsController', ['$scope', '$location', '$timeout', '$translate', '$interval', 'Client', function ($scope, $location, $timeout, $translate, $interval, Client) {
|
||||
Client.onReady(function () { if (!Client.getUserInfo().isAtLeastAdmin) $location.path('/'); });
|
||||
@@ -80,6 +80,29 @@ angular.module('Application').controller('NotificationsController', ['$scope', '
|
||||
});
|
||||
};
|
||||
|
||||
$scope.settings = {
|
||||
busy: false,
|
||||
config: {},
|
||||
|
||||
show: function () {
|
||||
for (const s of Client.getUserInfo().notificationConfig) {
|
||||
$scope.settings.config[s] = true;
|
||||
}
|
||||
|
||||
$('#notificationsSettingsModal').modal('show');
|
||||
},
|
||||
|
||||
submit: function () {
|
||||
const config = Object.keys($scope.settings.config).filter(c => $scope.settings.config[c] === true);
|
||||
Client.setNotificationConfig(config, function (error) {
|
||||
if (error) return Client.error(error);
|
||||
|
||||
Client.refreshConfig();
|
||||
$('#notificationsSettingsModal').modal('hide');
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
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 () {
|
||||
|
||||
Reference in New Issue
Block a user