fixed based on e2e finding a bug!

This commit is contained in:
Wyatt Johnson
2017-12-04 14:06:32 -07:00
parent 87ef0f1cb9
commit 3b4e69f06e
2 changed files with 39 additions and 16 deletions
+11 -4
View File
@@ -1,4 +1,5 @@
const errors = require('../../errors');
const UsersService = require('../../services/users');
const {CREATE_ACTION, DELETE_ACTION} = require('../../perms/constants');
const {
IGNORE_FLAGS_AGAINST_STAFF,
@@ -82,11 +83,17 @@ const createAction = async (ctx, {item_id, item_type, action_type, group_id, met
metadata
});
if (action_type === 'FLAG' && item_type === 'COMMENTS') {
if (action_type === 'FLAG') {
if (item_type === 'USERS') {
// The item is a comment, and this is a flag. Push that the comment was
// flagged, don't wait for it to finish.
pubsub.publish('commentFlagged', item);
// Set the user's status as pending, as we need to review it.
await UsersService.setStatus(item_id, 'PENDING');
} else if (item_type === 'COMMENTS') {
// The item is a comment, and this is a flag. Push that the comment was
// flagged, don't wait for it to finish.
pubsub.publish('commentFlagged', item);
}
}
return action;