1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Refactor a little bit controllers

This commit is contained in:
Chocobozzz 2021-05-12 14:51:17 +02:00
parent c00100b607
commit c158a5faab
No known key found for this signature in database
GPG key ID: 583A612D890159BE
14 changed files with 625 additions and 504 deletions

View file

@ -162,6 +162,7 @@ async function updateVideoChannelBanner (req: express.Request, res: express.Resp
return res.json({ banner: banner.toFormattedJSON() })
}
async function updateVideoChannelAvatar (req: express.Request, res: express.Response) {
const avatarPhysicalFile = req.files['avatarfile'][0]
const videoChannel = res.locals.videoChannel
@ -221,10 +222,6 @@ async function updateVideoChannel (req: express.Request, res: express.Response)
try {
await sequelizeTypescript.transaction(async t => {
const sequelizeOptions = {
transaction: t
}
if (videoChannelInfoToUpdate.displayName !== undefined) videoChannelInstance.name = videoChannelInfoToUpdate.displayName
if (videoChannelInfoToUpdate.description !== undefined) videoChannelInstance.description = videoChannelInfoToUpdate.description
@ -238,7 +235,7 @@ async function updateVideoChannel (req: express.Request, res: express.Response)
}
}
const videoChannelInstanceUpdated = await videoChannelInstance.save(sequelizeOptions) as MChannelBannerAccountDefault
const videoChannelInstanceUpdated = await videoChannelInstance.save({ transaction: t }) as MChannelBannerAccountDefault
await sendUpdateActor(videoChannelInstanceUpdated, t)
auditLogger.update(