diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-22 10:46:54 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-22 10:46:54 +0200 |
commit | d636ab58d042494ef9d17b2d9c4c841bae01c897 (patch) | |
tree | c199a0b346ca20f6891495a9b312a3009da9eb30 /server | |
parent | 5c5e587307a27e173333789b5b5167d35f468b01 (diff) | |
download | PeerTube-d636ab58d042494ef9d17b2d9c4c841bae01c897.tar.gz PeerTube-d636ab58d042494ef9d17b2d9c4c841bae01c897.tar.zst PeerTube-d636ab58d042494ef9d17b2d9c4c841bae01c897.zip |
Fix html tag with blacklisted video
Diffstat (limited to 'server')
-rw-r--r-- | server/lib/client-html.ts | 4 | ||||
-rw-r--r-- | server/models/video/video.ts | 14 | ||||
-rw-r--r-- | server/typings/models/video/video.ts | 4 |
3 files changed, 20 insertions, 2 deletions
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 { | |||
42 | 42 | ||
43 | const [ html, video ] = await Promise.all([ | 43 | const [ html, video ] = await Promise.all([ |
44 | ClientHtml.getIndexHTML(req, res), | 44 | ClientHtml.getIndexHTML(req, res), |
45 | VideoModel.load(videoId) | 45 | VideoModel.loadWithBlacklist(videoId) |
46 | ]) | 46 | ]) |
47 | 47 | ||
48 | // Let Angular application handle errors | 48 | // Let Angular application handle errors |
49 | if (!video || video.privacy === VideoPrivacy.PRIVATE) { | 49 | if (!video || video.privacy === VideoPrivacy.PRIVATE || video.VideoBlacklist) { |
50 | return ClientHtml.getIndexHTML(req, res) | 50 | return ClientHtml.getIndexHTML(req, res) |
51 | } | 51 | } |
52 | 52 | ||
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 { | |||
135 | MVideoFullLight, | 135 | MVideoFullLight, |
136 | MVideoIdThumbnail, | 136 | MVideoIdThumbnail, |
137 | MVideoThumbnail, | 137 | MVideoThumbnail, |
138 | MVideoThumbnailBlacklist, | ||
138 | MVideoWithAllFiles, | 139 | MVideoWithAllFiles, |
139 | MVideoWithFile, | 140 | MVideoWithFile, |
140 | MVideoWithRights | 141 | MVideoWithRights |
@@ -1409,6 +1410,19 @@ export class VideoModel extends Model<VideoModel> { | |||
1409 | return VideoModel.scope(ScopeNames.WITH_THUMBNAILS).findOne(options) | 1410 | return VideoModel.scope(ScopeNames.WITH_THUMBNAILS).findOne(options) |
1410 | } | 1411 | } |
1411 | 1412 | ||
1413 | static loadWithBlacklist (id: number | string, t?: Transaction): Bluebird<MVideoThumbnailBlacklist> { | ||
1414 | const where = buildWhereIdOrUUID(id) | ||
1415 | const options = { | ||
1416 | where, | ||
1417 | transaction: t | ||
1418 | } | ||
1419 | |||
1420 | return VideoModel.scope([ | ||
1421 | ScopeNames.WITH_THUMBNAILS, | ||
1422 | ScopeNames.WITH_BLACKLISTED | ||
1423 | ]).findOne(options) | ||
1424 | } | ||
1425 | |||
1412 | static loadWithRights (id: number | string, t?: Transaction): Bluebird<MVideoWithRights> { | 1426 | static loadWithRights (id: number | string, t?: Transaction): Bluebird<MVideoWithRights> { |
1413 | const where = buildWhereIdOrUUID(id) | 1427 | const where = buildWhereIdOrUUID(id) |
1414 | const options = { | 1428 | 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 & | |||
52 | Use<'VideoFiles', MVideoFile[]> & | 52 | Use<'VideoFiles', MVideoFile[]> & |
53 | Use<'Thumbnails', MThumbnail[]> | 53 | Use<'Thumbnails', MThumbnail[]> |
54 | 54 | ||
55 | export type MVideoThumbnailBlacklist = MVideo & | ||
56 | Use<'Thumbnails', MThumbnail[]> & | ||
57 | Use<'VideoBlacklist', MVideoBlacklistLight> | ||
58 | |||
55 | export type MVideoTag = MVideo & | 59 | export type MVideoTag = MVideo & |
56 | Use<'Tags', MTag[]> | 60 | Use<'Tags', MTag[]> |
57 | 61 | ||