]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/users/me.ts
add webtorrent opt-out settings
[github/Chocobozzz/PeerTube.git] / server / controllers / api / users / me.ts
index eba1e7eddbe5278e852c148835b273b50ffa3536..f78294f17ec205b7f5ba022181ec7e5b9944e7a7 100644 (file)
@@ -87,7 +87,7 @@ meRouter.get('/me/videos/:videoId/rating',
 
 meRouter.put('/me',
   authenticate,
-  usersUpdateMeValidator,
+  asyncMiddleware(usersUpdateMeValidator),
   asyncRetryTransactionMiddleware(updateMe)
 )
 
@@ -327,6 +327,7 @@ async function updateMe (req: express.Request, res: express.Response, next: expr
   if (body.password !== undefined) user.password = body.password
   if (body.email !== undefined) user.email = body.email
   if (body.nsfwPolicy !== undefined) user.nsfwPolicy = body.nsfwPolicy
+  if (body.webTorrentPolicy !== undefined) user.webTorrentPolicy = body.webTorrentPolicy
   if (body.autoPlayVideo !== undefined) user.autoPlayVideo = body.autoPlayVideo
 
   await sequelizeTypescript.transaction(async t => {
@@ -353,7 +354,7 @@ async function updateMyAvatar (req: express.Request, res: express.Response, next
 
   const userAccount = await AccountModel.load(user.Account.id)
 
-  const avatar = await updateActorAvatarFile(avatarPhysicalFile, userAccount.Actor, userAccount)
+  const avatar = await updateActorAvatarFile(avatarPhysicalFile, userAccount)
 
   auditLogger.update(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON()), oldUserAuditView)