X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fapi%2Fvideos%2Fownership.ts;h=a85d7c30b692fdc5f6c4b7ece9e87dbb29f2b7a4;hb=c00100b607ab97dfea690880434657b7ee11466d;hp=540a49010198833c2d928f83215039b4d9b3f9b4;hpb=610d0be13b3d01f653ef269271dd667a57c85ef2;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/api/videos/ownership.ts b/server/controllers/api/videos/ownership.ts index 540a49010..a85d7c30b 100644 --- a/server/controllers/api/videos/ownership.ts +++ b/server/controllers/api/videos/ownership.ts @@ -18,7 +18,8 @@ import { getFormattedObjects } from '../../../helpers/utils' import { changeVideoChannelShare } from '../../../lib/activitypub/share' import { sendUpdateVideo } from '../../../lib/activitypub/send' import { VideoModel } from '../../../models/video/video' -import { MVideoFullLight } from '@server/typings/models' +import { MVideoFullLight } from '@server/types/models' +import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' const ownershipVideoRouter = express.Router() @@ -80,7 +81,9 @@ async function giveVideoOwnership (req: express.Request, res: express.Response) }) logger.info('Ownership change for video %s created.', videoInstance.name) - return res.type('json').status(204).end() + return res.type('json') + .status(HttpStatusCode.NO_CONTENT_204) + .end() } async function listVideoOwnership (req: express.Request, res: express.Response) { @@ -104,7 +107,7 @@ async function acceptOwnership (req: express.Request, res: express.Response) { // We need more attributes for federation const targetVideo = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoChangeOwnership.Video.id) - const oldVideoChannel = await VideoChannelModel.loadByIdAndPopulateAccount(targetVideo.channelId) + const oldVideoChannel = await VideoChannelModel.loadAndPopulateAccount(targetVideo.channelId) targetVideo.channelId = channel.id @@ -119,7 +122,7 @@ async function acceptOwnership (req: express.Request, res: express.Response) { videoChangeOwnership.status = VideoChangeOwnershipStatus.ACCEPTED await videoChangeOwnership.save({ transaction: t }) - return res.sendStatus(204) + return res.sendStatus(HttpStatusCode.NO_CONTENT_204) }) } @@ -130,6 +133,6 @@ async function refuseOwnership (req: express.Request, res: express.Response) { videoChangeOwnership.status = VideoChangeOwnershipStatus.REFUSED await videoChangeOwnership.save({ transaction: t }) - return res.sendStatus(204) + return res.sendStatus(HttpStatusCode.NO_CONTENT_204) }) }