From 350e679abf88eca8d95154cd368b93abf25b521c Mon Sep 17 00:00:00 2001 From: PepeFranco Date: Mon, 30 Oct 2017 16:58:51 -0600 Subject: [PATCH] Added check for user & comments --- graph/mutators/action.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/graph/mutators/action.js b/graph/mutators/action.js index 60f939477..a5bf16051 100644 --- a/graph/mutators/action.js +++ b/graph/mutators/action.js @@ -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;