From 343d1395df2e07ea9eb3540724c9fd689e617cb8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 15 Feb 2023 13:50:40 +0100 Subject: Prefer displaying channel for playlist element --- .../src/app/shared/shared-main/video/video.service.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'client/src/app/shared/shared-main/video') diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts index 8c8b1e08f..152149827 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts @@ -420,6 +420,24 @@ export class VideoService { : 'both' } + // Choose if we display by default the account or the channel + buildDefaultOwnerDisplayType (video: Video) { + const accountName = video.account.name + + // If the video channel name is an UUID (not really displayable, we changed this behaviour in v1.0.0-beta.12) + // Or has not been customized (default created channel display name) + // -> Use the account name + if ( + video.channel.displayName === `Default ${accountName} channel` || + video.channel.displayName === `Main ${accountName} channel` || + video.channel.name.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/) + ) { + return 'account' as 'account' + } + + return 'videoChannel' as 'videoChannel' + } + buildCommonVideosParams (options: CommonVideoParams & { params: HttpParams }) { const { params, -- cgit v1.2.3