users: send private user in USER_UPDATE to self

- users: send updated user as a reply on PATCH /api/v6/users/@me
This commit is contained in:
Luna Mendes 2018-11-19 16:25:09 -03:00
parent eccc82afcc
commit 98d6e7082d
1 changed files with 3 additions and 2 deletions

View File

@ -207,6 +207,7 @@ async def patch_me():
user.pop('password_hash') user.pop('password_hash')
public_user = await app.storage.get_user(user_id) public_user = await app.storage.get_user(user_id)
private_user = await app.storage.get_user(user_id, secure=True)
session_ids = [] session_ids = []
# by using dispatch_with_filter # by using dispatch_with_filter
@ -214,7 +215,7 @@ async def patch_me():
# a USER_UPDATE once and not any others. # a USER_UPDATE once and not any others.
session_ids.extend( session_ids.extend(
await app.dispatcher.dispatch_user( await app.dispatcher.dispatch_user(
user_id, 'USER_UPDATE', public_user) user_id, 'USER_UPDATE', private_user)
) )
guild_ids = await app.user_storage.get_user_guilds(user_id) guild_ids = await app.user_storage.get_user_guilds(user_id)
@ -234,7 +235,7 @@ async def patch_me():
) )
) )
return jsonify(user) return jsonify(private_user)
@bp.route('/@me/guilds', methods=['GET']) @bp.route('/@me/guilds', methods=['GET'])