]>
Commit | Line | Data |
---|---|---|
1 | import { Response } from 'express' | |
2 | import { MUserId } from '@server/types/models' | |
3 | import { MVideoChangeOwnershipFull } from '@server/types/models/video/video-change-ownership' | |
4 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' | |
5 | ||
6 | function checkUserCanTerminateOwnershipChange (user: MUserId, videoChangeOwnership: MVideoChangeOwnershipFull, res: Response) { | |
7 | if (videoChangeOwnership.NextOwner.userId === user.id) { | |
8 | return true | |
9 | } | |
10 | ||
11 | res.fail({ | |
12 | status: HttpStatusCode.FORBIDDEN_403, | |
13 | message: 'Cannot terminate an ownership change of another user' | |
14 | }) | |
15 | return false | |
16 | } | |
17 | ||
18 | export { | |
19 | checkUserCanTerminateOwnershipChange | |
20 | } |