Adds graphql for users flagged in the server and client.

This commit is contained in:
gaba
2017-02-28 21:33:01 -08:00
parent ca4b03872b
commit da3c812dc1
11 changed files with 378 additions and 67 deletions
+16
View File
@@ -72,6 +72,22 @@ const RootQuery = {
}
return user;
},
// This endpoint is used for loading the user moderation queues (users whose username has been flagged),
// so hide it in the event that we aren't an admin.
usersFlagged(_, args, {user, loaders: {Users, Actions}}) {
if (user == null || !user.hasRoles('ADMIN')) {
return null;
}
return Actions.getByTypes({action_type: 'FLAG', item_type: 'USERS'})
.then((ids) => {
// Perform the query using the available resolver.
return Users.getByQuery({ids});
});
}
};