diff options
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/custom-validators/videos.ts | 4 | ||||
-rw-r--r-- | server/helpers/video.ts | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index 9875c68bd..714f7ac95 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts | |||
@@ -154,7 +154,9 @@ function checkUserCanManageVideo (user: UserModel, video: VideoModel, right: Use | |||
154 | } | 154 | } |
155 | 155 | ||
156 | async function isVideoExist (id: string, res: Response, fetchType: VideoFetchType = 'all') { | 156 | async function isVideoExist (id: string, res: Response, fetchType: VideoFetchType = 'all') { |
157 | const video = await fetchVideo(id, fetchType) | 157 | const userId = res.locals.oauth ? res.locals.oauth.token.User.id : undefined |
158 | |||
159 | const video = await fetchVideo(id, fetchType, userId) | ||
158 | 160 | ||
159 | if (video === null) { | 161 | if (video === null) { |
160 | res.status(404) | 162 | res.status(404) |
diff --git a/server/helpers/video.ts b/server/helpers/video.ts index b1577a6b0..1bd21467d 100644 --- a/server/helpers/video.ts +++ b/server/helpers/video.ts | |||
@@ -2,8 +2,8 @@ import { VideoModel } from '../models/video/video' | |||
2 | 2 | ||
3 | type VideoFetchType = 'all' | 'only-video' | 'id' | 'none' | 3 | type VideoFetchType = 'all' | 'only-video' | 'id' | 'none' |
4 | 4 | ||
5 | function fetchVideo (id: number | string, fetchType: VideoFetchType) { | 5 | function fetchVideo (id: number | string, fetchType: VideoFetchType, userId?: number) { |
6 | if (fetchType === 'all') return VideoModel.loadAndPopulateAccountAndServerAndTags(id) | 6 | if (fetchType === 'all') return VideoModel.loadAndPopulateAccountAndServerAndTags(id, undefined, userId) |
7 | 7 | ||
8 | if (fetchType === 'only-video') return VideoModel.load(id) | 8 | if (fetchType === 'only-video') return VideoModel.load(id) |
9 | 9 | ||