Implement live update for reported users

This commit is contained in:
Chi Vinh Le
2018-01-17 15:20:38 +01:00
parent 519480c0e4
commit ee78f08598
12 changed files with 247 additions and 4 deletions
+11
View File
@@ -10,6 +10,7 @@ const {
SUBSCRIBE_ALL_USERNAME_REJECTED,
SUBSCRIBE_ALL_USERNAME_APPROVED,
SUBSCRIBE_ALL_USERNAME_FLAGGED,
SUBSCRIBE_ALL_USERNAME_CHANGED,
} = require('../perms/constants');
const merge = require('lodash/merge');
@@ -128,6 +129,16 @@ const setupFunctions = {
}
return !args.user_id || user.id === args.user_id;
},
usernameChanged: (options, args, user, context) => {
if (
!context.user ||
(args.user_id !== user.id &&
!context.user.can(SUBSCRIBE_ALL_USERNAME_CHANGED))
) {
return false;
}
return !args.user_id || user.id === args.user_id;
},
};
/**