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:
parent
c00100b607
commit
c158a5faab
14 changed files with 625 additions and 504 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue