You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
main
${ noResults }
21 lines
652 B
TypeScript
21 lines
652 B
TypeScript
import { Response } from 'express'
|
|||
import { HttpStatusCode } from '@peertube/peertube-models'
|
|||
import { MUserId } from '@server/types/models/index.js'
|
|||
import { MVideoChangeOwnershipFull } from '@server/types/models/video/video-change-ownership.js'
|
|||
|
|||
function checkUserCanTerminateOwnershipChange (user: MUserId, videoChangeOwnership: MVideoChangeOwnershipFull, res: Response) {
|
|||
if (videoChangeOwnership.NextOwner.userId === user.id) {
|
|||
return true
|
|||
}
|
|||
|
|||
res.fail({
|
|||
status: HttpStatusCode.FORBIDDEN_403,
|
|||
message: 'Cannot terminate an ownership change of another user'
|
|||
})
|
|||
return false
|
|||
}
|
|||
|
|||
export {
|
|||
checkUserCanTerminateOwnershipChange
|
|||
}
|