Fix avatar update
authorChocobozzz <me@florianbigard.com>
Thu, 4 Jan 2018 13:53:25 +0000 (14:53 +0100)
committerChocobozzz <me@florianbigard.com>
Thu, 4 Jan 2018 13:53:25 +0000 (14:53 +0100)
server/controllers/api/users.ts

index d8ecbdbe2f042b3663d22b59ef30e1cf807318ee..2d77a52494e0e1cec2813db66da6b164b232a2ae 100644 (file)
@@ -249,11 +249,12 @@ async function updateMyAvatar (req: express.Request, res: express.Response, next
   await unlinkPromise(source)
 
   const avatar = await sequelizeTypescript.transaction(async t => {
-    await updateActorAvatarInstance(actor, avatarName, t)
+    const updatedActor = await updateActorAvatarInstance(actor, avatarName, t)
+    await updatedActor.save({ transaction: t })
 
     await sendUpdateUser(user, t)
 
-    return avatar
+    return updatedActor.Avatar
   })
 
   return res