Notification delivery (#6072)

* ability for users to choose how they receive notifications

add type field to more notifications, the type field is used to
determine what to do based on user
setting(none,notification,email,notificationemail)

* change var name to types

* cleanup

* add event types for privileged users

* remove unused language keys

* fix uids check

* changed if statements

* upgrade script to preserver old settings
This commit is contained in:
Barış Soner Uşaklı
2017-11-15 21:35:10 -05:00
committed by GitHub
parent e68e5122e2
commit dd176dd5f2
14 changed files with 329 additions and 137 deletions

View File

@@ -208,13 +208,17 @@ User.isGlobalModerator = function (uid, callback) {
privileges.users.isGlobalModerator(uid, callback);
};
User.getPrivileges = function (uid, callback) {
async.parallel({
isAdmin: async.apply(User.isAdministrator, uid),
isGlobalModerator: async.apply(User.isGlobalModerator, uid),
isModeratorOfAnyCategory: async.apply(User.isModeratorOfAnyCategory, uid),
}, callback);
};
User.isPrivileged = function (uid, callback) {
async.parallel([
async.apply(User.isAdministrator, uid),
async.apply(User.isGlobalModerator, uid),
async.apply(User.isModeratorOfAnyCategory, uid),
], function (err, results) {
callback(err, results ? results.some(Boolean) : false);
User.getPrivileges(uid, function (err, results) {
callback(err, results ? (results.isAdmin || results.isGlobalModerator || results.isModeratorOfAnyCategory) : false);
});
};