mirror of
https://github.com/wassname/talk.git
synced 2026-09-09 11:38:08 +08:00
refactored resolvers, cleaned
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
const { decorateWithPermissionCheck, checkSelfField } = require('./util');
|
||||
const { VIEW_USER_STATUS } = require('../../perms/constants');
|
||||
|
||||
const UserState = {
|
||||
status: (user, args, ctx) => {
|
||||
if (
|
||||
ctx.user &&
|
||||
(ctx.user.id === user.id || ctx.user.can(VIEW_USER_STATUS))
|
||||
) {
|
||||
return user.status;
|
||||
}
|
||||
},
|
||||
};
|
||||
const UserState = {};
|
||||
|
||||
decorateWithPermissionCheck(
|
||||
UserState,
|
||||
{ status: [VIEW_USER_STATUS] },
|
||||
checkSelfField('id')
|
||||
);
|
||||
|
||||
module.exports = UserState;
|
||||
|
||||
Reference in New Issue
Block a user