diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/users/me.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts index fb1ddbc6d..bf872ca52 100644 --- a/server/controllers/api/users/me.ts +++ b/server/controllers/api/users/me.ts | |||
@@ -190,19 +190,19 @@ async function updateMe (req: express.Request, res: express.Response) { | |||
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
193 | if (body.displayName !== undefined || body.description !== undefined) { | 193 | await sequelizeTypescript.transaction(async t => { |
194 | await sequelizeTypescript.transaction(async t => { | 194 | await user.save({ transaction: t }) |
195 | const userAccount = await AccountModel.load(user.Account.id, t) | ||
196 | 195 | ||
197 | await user.save({ transaction: t }) | 196 | if (body.displayName !== undefined || body.description !== undefined) { |
197 | const userAccount = await AccountModel.load(user.Account.id, t) | ||
198 | 198 | ||
199 | if (body.displayName !== undefined) userAccount.name = body.displayName | 199 | if (body.displayName !== undefined) userAccount.name = body.displayName |
200 | if (body.description !== undefined) userAccount.description = body.description | 200 | if (body.description !== undefined) userAccount.description = body.description |
201 | await userAccount.save({ transaction: t }) | 201 | await userAccount.save({ transaction: t }) |
202 | 202 | ||
203 | await sendUpdateActor(userAccount, t) | 203 | await sendUpdateActor(userAccount, t) |
204 | }) | 204 | } |
205 | } | 205 | }) |
206 | 206 | ||
207 | if (sendVerificationEmail === true) { | 207 | if (sendVerificationEmail === true) { |
208 | await sendVerifyUserEmail(user, true) | 208 | await sendVerifyUserEmail(user, true) |