Merge branch 'master' into moderation-refactor

This commit is contained in:
Wyatt Johnson
2018-01-22 16:34:56 -07:00
committed by GitHub
45 changed files with 690 additions and 144 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('usernameFlagged', item);
break;
default:
}
}
return action;
+4 -1
View File
@@ -56,7 +56,10 @@ const stopIgnoringUser = ({ user }, userToStopIgnoring) => {
};
const changeUsername = async (ctx, id, username) => {
return UsersService.changeUsername(id, username, ctx.user.id);
const user = await UsersService.changeUsername(id, username, ctx.user.id);
const previousUsername = ctx.user.username;
ctx.pubsub.publish('usernameChanged', { previousUsername, user });
return user;
};
const setUsername = async (ctx, id, username) => {