mirror of
https://github.com/wassname/talk.git
synced 2026-09-12 13:01:11 +08:00
fixed query issues
This commit is contained in:
@@ -22,6 +22,7 @@ const TagLink = require('./tag_link');
|
||||
const Tag = require('./tag');
|
||||
const UserError = require('./user_error');
|
||||
const User = require('./user');
|
||||
const UserState = require('./user_state');
|
||||
const ValidationUserError = require('./validation_user_error');
|
||||
|
||||
const plugins = require('../../services/plugins');
|
||||
@@ -49,6 +50,7 @@ let resolvers = {
|
||||
Tag,
|
||||
UserError,
|
||||
User,
|
||||
UserState,
|
||||
ValidationUserError,
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ const {
|
||||
SEARCH_OTHERS_COMMENTS,
|
||||
UPDATE_USER_ROLES,
|
||||
SEARCH_COMMENT_METRICS,
|
||||
LIST_OWN_TOKENS
|
||||
LIST_OWN_TOKENS,
|
||||
VIEW_USER_STATUS
|
||||
} = require('../../perms/constants');
|
||||
|
||||
const User = {
|
||||
@@ -83,12 +84,11 @@ const User = {
|
||||
}
|
||||
},
|
||||
|
||||
// suspension({id, suspension}, _, {user}) {
|
||||
// if (user.id !== id && !user.can(VIEW_SUSPENSION_INFO)) {
|
||||
// return null;
|
||||
// }
|
||||
// return suspension;
|
||||
// }
|
||||
state(user, args, ctx) {
|
||||
if (ctx.user && (ctx.user.id === user.id || ctx.user.can(VIEW_USER_STATUS))) {
|
||||
return user;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Decorate the User type resolver with a tags field.
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = UserState;
|
||||
Reference in New Issue
Block a user