aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-02-15 13:50:40 +0100
committerChocobozzz <me@florianbigard.com>2023-02-15 13:50:40 +0100
commit343d1395df2e07ea9eb3540724c9fd689e617cb8 (patch)
treeacd553f76c1daab05f4cf44c66234467c5ea9b36 /client/src/app/shared
parent72c98d189ef7b18264a7f715d7a58910eba29a1c (diff)
downloadPeerTube-343d1395df2e07ea9eb3540724c9fd689e617cb8.tar.gz
PeerTube-343d1395df2e07ea9eb3540724c9fd689e617cb8.tar.zst
PeerTube-343d1395df2e07ea9eb3540724c9fd689e617cb8.zip
Prefer displaying channel for playlist element
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/shared-main/video/video.service.ts18
-rw-r--r--client/src/app/shared/shared-video-miniature/video-miniature.component.html8
-rw-r--r--client/src/app/shared/shared-video-miniature/video-miniature.component.ts18
-rw-r--r--client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.html6
-rw-r--r--client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.scss4
-rw-r--r--client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts7
6 files changed, 36 insertions, 25 deletions
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 {
420 : 'both' 420 : 'both'
421 } 421 }
422 422
423 // Choose if we display by default the account or the channel
424 buildDefaultOwnerDisplayType (video: Video) {
425 const accountName = video.account.name
426
427 // If the video channel name is an UUID (not really displayable, we changed this behaviour in v1.0.0-beta.12)
428 // Or has not been customized (default created channel display name)
429 // -> Use the account name
430 if (
431 video.channel.displayName === `Default ${accountName} channel` ||
432 video.channel.displayName === `Main ${accountName} channel` ||
433 video.channel.name.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/)
434 ) {
435 return 'account' as 'account'
436 }
437
438 return 'videoChannel' as 'videoChannel'
439 }
440
423 buildCommonVideosParams (options: CommonVideoParams & { params: HttpParams }) { 441 buildCommonVideosParams (options: CommonVideoParams & { params: HttpParams }) {
424 const { 442 const {
425 params, 443 params,
diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.html b/client/src/app/shared/shared-video-miniature/video-miniature.component.html
index 227c12130..7d3c3dbfc 100644
--- a/client/src/app/shared/shared-video-miniature/video-miniature.component.html
+++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.html
@@ -40,11 +40,9 @@
40 </span> 40 </span>
41 </span> 41 </span>
42 42
43 <a tabindex="-1" *ngIf="displayOptions.by && displayOwnerAccount()" class="video-miniature-account" [routerLink]="[ '/c', video.byVideoChannel ]"> 43 <a tabindex="-1" *ngIf="displayOptions.by" class="video-miniature-account" [routerLink]="[ '/c', video.byVideoChannel ]">
44 {{ authorAccount }} 44 <ng-container *ngIf="displayOwnerAccount()">{{ authorAccount }}</ng-container>
45 </a> 45 <ng-container *ngIf="displayOwnerVideoChannel()">{{ authorChannel }}</ng-container>
46 <a tabindex="-1" *ngIf="displayOptions.by && displayOwnerVideoChannel()" class="video-miniature-channel" [routerLink]="[ '/c', video.byVideoChannel ]">
47 {{ authorChannel }}
48 </a> 46 </a>
49 47
50 <div class="video-info-privacy"> 48 <div class="video-info-privacy">
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 706227e66..2384b34d7 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
@@ -14,7 +14,7 @@ import { AuthService, ScreenService, ServerService, User } from '@app/core'
14import { HTMLServerConfig, VideoExistInPlaylist, VideoPlaylistType, VideoPrivacy, VideoState } from '@shared/models' 14import { HTMLServerConfig, VideoExistInPlaylist, VideoPlaylistType, VideoPrivacy, VideoState } from '@shared/models'
15import { LinkType } from '../../../types/link.type' 15import { LinkType } from '../../../types/link.type'
16import { ActorAvatarSize } from '../shared-actor-image/actor-avatar.component' 16import { ActorAvatarSize } from '../shared-actor-image/actor-avatar.component'
17import { Video } from '../shared-main' 17import { Video, VideoService } from '../shared-main'
18import { VideoPlaylistService } from '../shared-video-playlist' 18import { VideoPlaylistService } from '../shared-video-playlist'
19import { VideoActionsDisplayType } from './video-actions-dropdown.component' 19import { VideoActionsDisplayType } from './video-actions-dropdown.component'
20 20
@@ -103,6 +103,7 @@ export class VideoMiniatureComponent implements OnInit {
103 private serverService: ServerService, 103 private serverService: ServerService,
104 private authService: AuthService, 104 private authService: AuthService,
105 private videoPlaylistService: VideoPlaylistService, 105 private videoPlaylistService: VideoPlaylistService,
106 private videoService: VideoService,
106 private cd: ChangeDetectorRef, 107 private cd: ChangeDetectorRef,
107 @Inject(LOCALE_ID) private localeId: string 108 @Inject(LOCALE_ID) private localeId: string
108 ) {} 109 ) {}
@@ -276,20 +277,7 @@ export class VideoMiniatureComponent implements OnInit {
276 return 277 return
277 } 278 }
278 279
279 const accountName = this.video.account.name 280 this.ownerDisplayType = this.videoService.buildDefaultOwnerDisplayType(this.video)
280
281 // If the video channel name is an UUID (not really displayable, we changed this behaviour in v1.0.0-beta.12)
282 // Or has not been customized (default created channel display name)
283 // -> Use the account name
284 if (
285 this.video.channel.displayName === `Default ${accountName} channel` ||
286 this.video.channel.displayName === `Main ${accountName} channel` ||
287 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}$/)
288 ) {
289 this.ownerDisplayType = 'account'
290 } else {
291 this.ownerDisplayType = 'videoChannel'
292 }
293 } 281 }
294 282
295 private loadWatchLater () { 283 private loadWatchLater () {
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.html b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.html
index f58d5f7f6..40c58166d 100644
--- a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.html
+++ b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.html
@@ -32,9 +32,11 @@
32 </span> 32 </span>
33 </span> 33 </span>
34 34
35 <a *ngIf="accountLink" tabindex="-1" class="video-info-account" [routerLink]="[ '/a', playlistElement.video.byAccount ]"> 35 <a *ngIf="accountLink" tabindex="-1" class="video-info-owner" [routerLink]="[ '/c', playlistElement.video.byVideoChannel ]">
36 {{ playlistElement.video.byAccount }} 36 <ng-container *ngIf="getVideoOwnerDisplayType(playlistElement) === 'account'">{{ playlistElement.video.byAccount }}</ng-container>
37 <ng-container *ngIf="getVideoOwnerDisplayType(playlistElement) === 'videoChannel'">{{ playlistElement.video.byVideoChannel }}</ng-container>
37 </a> 38 </a>
39
38 <span *ngIf="!accountLink" tabindex="-1" class="video-info-account">{{ playlistElement.video.byAccount }}</span> 40 <span *ngIf="!accountLink" tabindex="-1" class="video-info-account">{{ playlistElement.video.byAccount }}</span>
39 41
40 <span tabindex="-1" class="video-info-timestamp">{{ formatTimestamp(playlistElement) }}</span> 42 <span tabindex="-1" class="video-info-timestamp">{{ formatTimestamp(playlistElement) }}</span>
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.scss b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.scss
index e6b01d33d..0f085231c 100644
--- a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.scss
+++ b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.scss
@@ -133,13 +133,13 @@ my-video-thumbnail,
133 } 133 }
134 } 134 }
135 135
136 .video-info-account, 136 .video-info-owner,
137 .video-info-timestamp { 137 .video-info-timestamp {
138 color: pvar(--greyForegroundColor); 138 color: pvar(--greyForegroundColor);
139 } 139 }
140} 140}
141 141
142.video-info-account, 142.video-info-owner,
143.video-miniature-created-at-views { 143.video-miniature-created-at-views {
144 font-size: 14px; 144 font-size: 14px;
145} 145}
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts
index 79b7b9a50..552ea742b 100644
--- a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts
+++ b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts
@@ -1,6 +1,6 @@
1import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' 1import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
2import { AuthService, Notifier, ServerService } from '@app/core' 2import { AuthService, Notifier, ServerService } from '@app/core'
3import { Video } from '@app/shared/shared-main' 3import { Video, VideoService } from '@app/shared/shared-main'
4import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' 4import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
5import { secondsToTime } from '@shared/core-utils' 5import { secondsToTime } from '@shared/core-utils'
6import { HTMLServerConfig, VideoPlaylistElementType, VideoPlaylistElementUpdate, VideoPrivacy } from '@shared/models' 6import { HTMLServerConfig, VideoPlaylistElementType, VideoPlaylistElementUpdate, VideoPrivacy } from '@shared/models'
@@ -44,6 +44,7 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit {
44 private serverService: ServerService, 44 private serverService: ServerService,
45 private notifier: Notifier, 45 private notifier: Notifier,
46 private videoPlaylistService: VideoPlaylistService, 46 private videoPlaylistService: VideoPlaylistService,
47 private videoService: VideoService,
47 private cdr: ChangeDetectorRef 48 private cdr: ChangeDetectorRef
48 ) {} 49 ) {}
49 50
@@ -51,6 +52,10 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit {
51 this.serverConfig = this.serverService.getHTMLConfig() 52 this.serverConfig = this.serverService.getHTMLConfig()
52 } 53 }
53 54
55 getVideoOwnerDisplayType (element: VideoPlaylistElement) {
56 return this.videoService.buildDefaultOwnerDisplayType(element.video)
57 }
58
54 isVideoPrivate () { 59 isVideoPrivate () {
55 return this.playlistElement.video.privacy.id === VideoPrivacy.PRIVATE 60 return this.playlistElement.video.privacy.id === VideoPrivacy.PRIVATE
56 } 61 }