Added check for user & comments

This commit is contained in:
PepeFranco
2017-10-30 16:58:51 -06:00
parent ae07dfb2cd
commit 350e679abf
+4 -2
View File
@@ -35,14 +35,16 @@ const createAction = async ({user = {}, pubsub, loaders: {Comments}}, {item_id,
// Set the user as pending if it was a user flag and user has no Admin, Staff or Moderation roles
let user = await UsersService.findById(item_id);
if(!user.roles)
if(!user.roles){
await UsersService.setStatus(item_id, 'PENDING');
}
}
if (comment) {
let user = await UsersService.findById(comment.author_id);
if(!user.roles)
if(!user.roles){
pubsub.publish('commentFlagged', comment);
}
}
return action;