]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/middlewares/videos.ts
hls-plugin: destroy hls upon third err
[github/Chocobozzz/PeerTube.git] / server / helpers / middlewares / videos.ts
index a0bbcdb21c0ceafa635f2e788b9cf4cf2674227c..3904f762aba6abbecf45eb34acb60a1e8c113ba5 100644 (file)
@@ -11,7 +11,7 @@ import {
   MVideoImmutable,
   MVideoThumbnail,
   MVideoWithRights
-} from '@server/typings/models'
+} from '@server/types/models'
 import { VideoFileModel } from '@server/models/video/video-file'
 
 async function doesVideoExist (id: number | string, res: Response, fetchType: VideoFetchType = 'all') {
@@ -92,9 +92,9 @@ async function doesVideoChannelOfAccountExist (channelId: number, user: MUserAcc
   return true
 }
 
-function checkUserCanManageVideo (user: MUser, video: MVideoAccountLight, right: UserRight, res: Response) {
+function checkUserCanManageVideo (user: MUser, video: MVideoAccountLight, right: UserRight, res: Response, onlyOwned = true) {
   // Retrieve the user who did the request
-  if (video.isOwned() === false) {
+  if (onlyOwned && video.isOwned() === false) {
     res.status(403)
        .json({ error: 'Cannot manage a video of another server.' })
        .end()