mirror of
https://github.com/wassname/talk.git
synced 2026-06-28 20:08:37 +08:00
23 lines
585 B
JavaScript
23 lines
585 B
JavaScript
const {SEARCH_OTHER_USERS} = require('../../perms/constants');
|
|
|
|
const Action = {
|
|
__resolveType({action_type}) {
|
|
switch (action_type) {
|
|
case 'DONTAGREE':
|
|
return 'DontAgreeAction';
|
|
case 'FLAG':
|
|
return 'FlagAction';
|
|
}
|
|
},
|
|
|
|
// This will load the user for the specific action. We'll limit this to the
|
|
// admin users only or the current logged in user.
|
|
user({user_id}, _, {loaders: {Users}, user}) {
|
|
if (user && (user.can(SEARCH_OTHER_USERS) || user_id === user.id)) {
|
|
return Users.getByID.load(user_id);
|
|
}
|
|
}
|
|
};
|
|
|
|
module.exports = Action;
|