diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts
index a33aef26d..a1f4ae858 100644
--- a/server/lib/client-html.ts
+++ b/server/lib/client-html.ts
@@ -42,11 +42,11 @@ export class ClientHtml {
const [ html, video ] = await Promise.all([
ClientHtml.getIndexHTML(req, res),
- VideoModel.load(videoId)
+ VideoModel.loadWithBlacklist(videoId)
])
// Let Angular application handle errors
- if (!video || video.privacy === VideoPrivacy.PRIVATE) {
+ if (!video || video.privacy === VideoPrivacy.PRIVATE || video.VideoBlacklist) {
return ClientHtml.getIndexHTML(req, res)
}
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index ab7b49f1e..6a95f6ef7 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -135,6 +135,7 @@ import {
MVideoFullLight,
MVideoIdThumbnail,
MVideoThumbnail,
+ MVideoThumbnailBlacklist,
MVideoWithAllFiles,
MVideoWithFile,
MVideoWithRights
@@ -1409,6 +1410,19 @@ export class VideoModel extends Model {
return VideoModel.scope(ScopeNames.WITH_THUMBNAILS).findOne(options)
}
+ static loadWithBlacklist (id: number | string, t?: Transaction): Bluebird {
+ const where = buildWhereIdOrUUID(id)
+ const options = {
+ where,
+ transaction: t
+ }
+
+ return VideoModel.scope([
+ ScopeNames.WITH_THUMBNAILS,
+ ScopeNames.WITH_BLACKLISTED
+ ]).findOne(options)
+ }
+
static loadWithRights (id: number | string, t?: Transaction): Bluebird {
const where = buildWhereIdOrUUID(id)
const options = {
diff --git a/server/typings/models/video/video.ts b/server/typings/models/video/video.ts
index be32d4617..9a53bd337 100644
--- a/server/typings/models/video/video.ts
+++ b/server/typings/models/video/video.ts
@@ -52,6 +52,10 @@ export type MVideoWithFileThumbnail = MVideo &
Use<'VideoFiles', MVideoFile[]> &
Use<'Thumbnails', MThumbnail[]>
+export type MVideoThumbnailBlacklist = MVideo &
+ Use<'Thumbnails', MThumbnail[]> &
+ Use<'VideoBlacklist', MVideoBlacklistLight>
+
export type MVideoTag = MVideo &
Use<'Tags', MTag[]>