mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-11-25 10:10:31 -06:00
Fix updating instance banner
This commit is contained in:
parent
7ee0efb57a
commit
cbfe10a43e
@ -631,6 +631,10 @@ describe('Test config', function () {
|
||||
await testFileExistsOrNot(server, 'avatars', basename(bannerPath), true)
|
||||
})
|
||||
|
||||
it('Should re-update an existing instance banner', async function () {
|
||||
await server.config.updateInstanceBanner({ fixture: 'banner.jpg' })
|
||||
})
|
||||
|
||||
it('Should remove instance banner', async function () {
|
||||
await server.config.deleteInstanceBanner()
|
||||
|
||||
|
@ -158,16 +158,19 @@ async function updateCustomConfig (req: express.Request, res: express.Response)
|
||||
async function updateInstanceBanner (req: express.Request, res: express.Response) {
|
||||
const bannerPhysicalFile = req.files['bannerfile'][0]
|
||||
|
||||
const accountServer = (await getServerActor()).Account
|
||||
await updateLocalActorImageFiles(accountServer, bannerPhysicalFile, ActorImageType.BANNER)
|
||||
const serverActor = await getServerActor()
|
||||
serverActor.Banners = await ActorImageModel.listByActor(serverActor, ActorImageType.BANNER) // Reload banners from DB
|
||||
|
||||
await updateLocalActorImageFiles(serverActor.Account, bannerPhysicalFile, ActorImageType.BANNER)
|
||||
|
||||
return res.sendStatus(HttpStatusCode.NO_CONTENT_204)
|
||||
}
|
||||
|
||||
async function deleteInstanceBanner (req: express.Request, res: express.Response) {
|
||||
const accountServer = (await getServerActor()).Account
|
||||
const serverActor = await getServerActor()
|
||||
serverActor.Banners = await ActorImageModel.listByActor(serverActor, ActorImageType.BANNER) // Reload banners from DB
|
||||
|
||||
await deleteLocalActorImageFile(accountServer, ActorImageType.BANNER)
|
||||
await deleteLocalActorImageFile(serverActor.Account, ActorImageType.BANNER)
|
||||
|
||||
return res.sendStatus(HttpStatusCode.NO_CONTENT_204)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user