notifications: per user email prefs

This commit is contained in:
Girish Ramakrishnan
2024-12-11 18:24:20 +01:00
parent 746e694d7e
commit 6004cd17bf
12 changed files with 130 additions and 27 deletions
+12 -1
View File
@@ -681,7 +681,8 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
source: null,
avatarUrl: null,
avatarType: null,
hasBackgroundImage: false
hasBackgroundImage: false,
notificationConfig: []
};
this._config = {
consoleServerOrigin: null,
@@ -813,6 +814,7 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
this._userInfo.avatarUrl = userInfo.avatarUrl + '?ts=' + Date.now(); // we add the timestamp to avoid caching
this._userInfo.avatarType = userInfo.avatarType;
this._userInfo.hasBackgroundImage = userInfo.hasBackgroundImage;
this._userInfo.notificationConfig = userInfo.notificationConfig;
this._userInfo.isAtLeastOwner = [ ROLES.OWNER ].indexOf(userInfo.role) !== -1;
this._userInfo.isAtLeastAdmin = [ ROLES.OWNER, ROLES.ADMIN ].indexOf(userInfo.role) !== -1;
this._userInfo.isAtLeastMailManager = [ ROLES.OWNER, ROLES.ADMIN, ROLES.MAIL_MANAGER ].indexOf(userInfo.role) !== -1;
@@ -2457,6 +2459,15 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
});
};
Client.prototype.setNotificationConfig = function (notificationConfig, callback) {
post('/api/v1/profile/notification_config', { notificationConfig }, null, function (error, data, status) {
if (error) return callback(error);
if (status !== 204) return callback(new ClientError(status, data));
callback(null, data);
});
};
Client.prototype.setProfileEmail = function (email, password, callback) {
post('/api/v1/profile/email', { email: email, password: password }, null, function (error, data, status) {
if (error) return callback(error);