diff options
Diffstat (limited to 'client/src/app/shared/shared-video-miniature/video-miniature.component.ts')
-rw-r--r-- | client/src/app/shared/shared-video-miniature/video-miniature.component.ts | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts index f08be9c25..987a65e40 100644 --- a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts | |||
@@ -16,7 +16,7 @@ import { Video } from '../shared-main' | |||
16 | import { VideoPlaylistService } from '../shared-video-playlist' | 16 | import { VideoPlaylistService } from '../shared-video-playlist' |
17 | import { VideoActionsDisplayType } from './video-actions-dropdown.component' | 17 | import { VideoActionsDisplayType } from './video-actions-dropdown.component' |
18 | 18 | ||
19 | export type OwnerDisplayType = 'account' | 'videoChannel' | 'auto' | 19 | export type OwnerDisplayType = 'account' | 'videoChannel' |
20 | export type MiniatureDisplayOptions = { | 20 | export type MiniatureDisplayOptions = { |
21 | date?: boolean | 21 | date?: boolean |
22 | views?: boolean | 22 | views?: boolean |
@@ -40,7 +40,6 @@ export class VideoMiniatureComponent implements OnInit { | |||
40 | @Input() user: User | 40 | @Input() user: User |
41 | @Input() video: Video | 41 | @Input() video: Video |
42 | 42 | ||
43 | @Input() ownerDisplayType: OwnerDisplayType = 'account' | ||
44 | @Input() displayOptions: MiniatureDisplayOptions = { | 43 | @Input() displayOptions: MiniatureDisplayOptions = { |
45 | date: true, | 44 | date: true, |
46 | views: true, | 45 | views: true, |
@@ -89,7 +88,7 @@ export class VideoMiniatureComponent implements OnInit { | |||
89 | videoHref: string | 88 | videoHref: string |
90 | videoTarget: string | 89 | videoTarget: string |
91 | 90 | ||
92 | private ownerDisplayTypeChosen: 'account' | 'videoChannel' | 91 | private ownerDisplayType: 'account' | 'videoChannel' |
93 | 92 | ||
94 | constructor ( | 93 | constructor ( |
95 | private screenService: ScreenService, | 94 | private screenService: ScreenService, |
@@ -140,11 +139,11 @@ export class VideoMiniatureComponent implements OnInit { | |||
140 | } | 139 | } |
141 | 140 | ||
142 | displayOwnerAccount () { | 141 | displayOwnerAccount () { |
143 | return this.ownerDisplayTypeChosen === 'account' | 142 | return this.ownerDisplayType === 'account' |
144 | } | 143 | } |
145 | 144 | ||
146 | displayOwnerVideoChannel () { | 145 | displayOwnerVideoChannel () { |
147 | return this.ownerDisplayTypeChosen === 'videoChannel' | 146 | return this.ownerDisplayType === 'videoChannel' |
148 | } | 147 | } |
149 | 148 | ||
150 | isUnlistedVideo () { | 149 | isUnlistedVideo () { |
@@ -245,21 +244,19 @@ export class VideoMiniatureComponent implements OnInit { | |||
245 | } | 244 | } |
246 | 245 | ||
247 | private setUpBy () { | 246 | private setUpBy () { |
248 | if (this.ownerDisplayType === 'account' || this.ownerDisplayType === 'videoChannel') { | 247 | const accountName = this.video.account.name |
249 | this.ownerDisplayTypeChosen = this.ownerDisplayType | ||
250 | return | ||
251 | } | ||
252 | 248 | ||
253 | // If the video channel name is an UUID (not really displayable, we changed this behaviour in v1.0.0-beta.12) | 249 | // If the video channel name is an UUID (not really displayable, we changed this behaviour in v1.0.0-beta.12) |
254 | // Or is just a suffix of the account (default created channel) | 250 | // Or has not been customized (default created channel display name) |
255 | // -> Use the account name | 251 | // -> Use the account name |
256 | if ( | 252 | if ( |
257 | this.video.channel.name === `${this.video.account.name}_channel` || | 253 | this.video.channel.displayName === `Default ${accountName} channel` || |
254 | this.video.channel.displayName === `Main ${accountName} channel` || | ||
258 | this.video.channel.name.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/) | 255 | this.video.channel.name.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/) |
259 | ) { | 256 | ) { |
260 | this.ownerDisplayTypeChosen = 'account' | 257 | this.ownerDisplayType = 'account' |
261 | } else { | 258 | } else { |
262 | this.ownerDisplayTypeChosen = 'videoChannel' | 259 | this.ownerDisplayType = 'videoChannel' |
263 | } | 260 | } |
264 | } | 261 | } |
265 | 262 | ||