From dedc7abb7beccb0b3a4a4fa4e8ccfef8ceecd5a6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 4 Sep 2019 15:03:50 +0200 Subject: [PATCH] Fix auto blacklist view --- .../shared/video-blacklist/video-blacklist.service.ts | 9 +++++---- .../src/app/shared/video/video-miniature.component.html | 2 +- client/src/app/shared/video/video-miniature.component.ts | 2 ++ server/models/video/video-blacklist.ts | 1 - 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/client/src/app/shared/video-blacklist/video-blacklist.service.ts b/client/src/app/shared/video-blacklist/video-blacklist.service.ts index a9eab9b6f..d65da85fe 100644 --- a/client/src/app/shared/video-blacklist/video-blacklist.service.ts +++ b/client/src/app/shared/video-blacklist/video-blacklist.service.ts @@ -34,7 +34,7 @@ export class VideoBlacklistService { ) } - getAutoBlacklistedAsVideoList (videoPagination: ComponentPagination): Observable<{ videos: Video[], totalVideos: number}> { + getAutoBlacklistedAsVideoList (videoPagination: ComponentPagination): Observable> { const pagination = this.restService.componentPaginationToRestPagination(videoPagination) // prioritize first created since waiting longest @@ -48,9 +48,10 @@ export class VideoBlacklistService { return this.authHttp.get>(VideoBlacklistService.BASE_VIDEOS_URL + 'blacklist', { params }) .pipe( map(res => { - const videos = res.data.map(videoBlacklist => new Video(videoBlacklist.video)) - const totalVideos = res.total - return { videos, totalVideos } + return { + total: res.total, + data: res.data.map(videoBlacklist => new Video(videoBlacklist.video)) + } }), catchError(res => this.restExtractor.handleError(res)) ) diff --git a/client/src/app/shared/video/video-miniature.component.html b/client/src/app/shared/video/video-miniature.component.html index 51ca1393d..5d5691b75 100644 --- a/client/src/app/shared/video/video-miniature.component.html +++ b/client/src/app/shared/video/video-miniature.component.html @@ -31,7 +31,7 @@
{{ video.privacy.label }} - - + - {{ getStateLabel(video) }}
diff --git a/client/src/app/shared/video/video-miniature.component.ts b/client/src/app/shared/video/video-miniature.component.ts index 48475033c..d5c7dfd9b 100644 --- a/client/src/app/shared/video/video-miniature.component.ts +++ b/client/src/app/shared/video/video-miniature.component.ts @@ -95,6 +95,8 @@ export class VideoMiniatureComponent implements OnInit { } getStateLabel (video: Video) { + if (!video.state) return '' + if (video.privacy.id !== VideoPrivacy.PRIVATE && video.state.id === VideoState.PUBLISHED) { return this.i18n('Published') } diff --git a/server/models/video/video-blacklist.ts b/server/models/video/video-blacklist.ts index 22d949da0..18a1b8b4b 100644 --- a/server/models/video/video-blacklist.ts +++ b/server/models/video/video-blacklist.ts @@ -64,7 +64,6 @@ export class VideoBlacklistModel extends Model { const countQuery = buildBaseQuery() const findQuery = buildBaseQuery() - findQuery.subQuery = false findQuery.include = [ { model: VideoModel, -- 2.25.1