Add previous username to notification

This commit is contained in:
Chi Vinh Le
2018-01-18 20:09:47 +01:00
parent ddf3816f5a
commit 544ef081dc
4 changed files with 24 additions and 7 deletions
+2 -1
View File
@@ -57,7 +57,8 @@ const stopIgnoringUser = ({ user }, userToStopIgnoring) => {
const changeUsername = async (ctx, id, username) => {
const user = await UsersService.changeUsername(id, username, ctx.user.id);
ctx.pubsub.publish('usernameChanged', user);
const previousUsername = ctx.user.username;
ctx.pubsub.publish('usernameChanged', { previousUsername, user });
return user;
};