Add userFlagged subscription

This commit is contained in:
Chi Vinh Le
2018-01-16 11:31:44 +01:00
parent 7885b025ee
commit 6aece16fd0
6 changed files with 35 additions and 4 deletions
+14 -4
View File
@@ -73,10 +73,20 @@ const createAction = async (
metadata,
});
if (action_type === 'FLAG' && 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);
if (action_type === 'FLAG') {
switch (item_type) {
case '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);
break;
case 'USERS':
// The item is a user, and this is a flag. Push that the user was
// flagged, don't wait for it to finish.
pubsub.publish('userFlagged', item);
break;
default:
}
}
return action;