Fix html tag with blacklisted video
This commit is contained in:
parent
5c5e587307
commit
d636ab58d0
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -135,6 +135,7 @@ import {
|
|||
MVideoFullLight,
|
||||
MVideoIdThumbnail,
|
||||
MVideoThumbnail,
|
||||
MVideoThumbnailBlacklist,
|
||||
MVideoWithAllFiles,
|
||||
MVideoWithFile,
|
||||
MVideoWithRights
|
||||
|
@ -1409,6 +1410,19 @@ export class VideoModel extends Model<VideoModel> {
|
|||
return VideoModel.scope(ScopeNames.WITH_THUMBNAILS).findOne(options)
|
||||
}
|
||||
|
||||
static loadWithBlacklist (id: number | string, t?: Transaction): Bluebird<MVideoThumbnailBlacklist> {
|
||||
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<MVideoWithRights> {
|
||||
const where = buildWhereIdOrUUID(id)
|
||||
const options = {
|
||||
|
|
|
@ -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[]>
|
||||
|
||||
|
|
Loading…
Reference in New Issue