aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>2021-10-12 14:23:44 +0200
committerGitHub <noreply@github.com>2021-10-12 14:23:44 +0200
commit7399a79f73cc2015e64fad49361439a322ee1d3b (patch)
tree134903063dbc66e5f3b12cc59669d061403bdde1
parent10ef089102f2225c5ec3ed426bc612e4f2bc8655 (diff)
downloadPeerTube-7399a79f73cc2015e64fad49361439a322ee1d3b.tar.gz
PeerTube-7399a79f73cc2015e64fad49361439a322ee1d3b.tar.zst
PeerTube-7399a79f73cc2015e64fad49361439a322ee1d3b.zip
add option to always show channel display name (#4422)
* add option to always show channel display name closes #4040 * show avatar in video miniatures closes #4040 * Revert "show avatar in video miniatures" This reverts commit 79b1a84140857fc24f7e2233e838d012f72bc56f. * channel display name: fix review comments
-rw-r--r--client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.html19
-rw-r--r--client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.scss20
-rw-r--r--client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.ts3
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.html2
-rw-r--r--client/src/app/shared/shared-video-miniature/video-miniature.component.html4
-rw-r--r--client/src/app/shared/shared-video-miniature/video-miniature.component.ts8
-rw-r--r--config/default.yaml5
-rw-r--r--config/production.yaml.example5
-rw-r--r--server/initializers/config.ts9
-rw-r--r--server/lib/server-config-manager.ts7
-rw-r--r--shared/models/server/server-config.model.ts8
11 files changed, 65 insertions, 25 deletions
diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.html b/client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.html
index 5a7221858..d433c7aba 100644
--- a/client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.html
+++ b/client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.html
@@ -1,11 +1,20 @@
1<div class="wrapper" [ngClass]="{ 'generic-channel': genericChannel }"> 1<div class="wrapper">
2 <my-actor-avatar 2 <my-actor-avatar
3 class="channel" [channel]="video.channel" 3 *ngIf="showChannel"
4 [internalHref]="[ '/c', video.byVideoChannel ]" [title]="channelLinkTitle" 4 class="channel"
5 [class.main-avatar]="showChannel"
6 [channel]="video.channel"
7 [internalHref]="[ '/c', video.byVideoChannel ]"
8 [title]="channelLinkTitle"
5 ></my-actor-avatar> 9 ></my-actor-avatar>
6 10
7 <my-actor-avatar 11 <my-actor-avatar
8 class="account" [account]="video.account" 12 *ngIf="showAccount"
9 [internalHref]="[ '/a', video.byAccount ]" [title]="accountLinkTitle"> 13 class="account"
14 [class.main-avatar]="!showChannel"
15 [class.second-avatar]="showChannel"
16 [account]="video.account"
17 [internalHref]="[ '/a', video.byAccount ]"
18 [title]="accountLinkTitle">
10 </my-actor-avatar> 19 </my-actor-avatar>
11</div> 20</div>
diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.scss b/client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.scss
index 1ff8fb96e..71c5e4b5a 100644
--- a/client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.scss
+++ b/client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.scss
@@ -20,23 +20,11 @@
20 position: relative; 20 position: relative;
21 margin-bottom: 5px; 21 margin-bottom: 5px;
22 22
23 &.generic-channel { 23 .main-avatar {
24 .account { 24 @include main();
25 @include main();
26 }
27
28 .channel {
29 display: none !important;
30 }
31 } 25 }
32 26
33 &:not(.generic-channel) { 27 .second-avatar {
34 .account { 28 @include secondary();
35 @include secondary();
36 }
37
38 .channel {
39 @include main();
40 }
41 } 29 }
42} 30}
diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.ts b/client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.ts
index 63edd7bad..146c440b3 100644
--- a/client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.ts
+++ b/client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.ts
@@ -10,7 +10,8 @@ export class VideoAvatarChannelComponent implements OnInit {
10 @Input() video: Video 10 @Input() video: Video
11 @Input() byAccount: string 11 @Input() byAccount: string
12 12
13 @Input() genericChannel: boolean 13 @Input() showAccount: boolean
14 @Input() showChannel: boolean
14 15
15 channelLinkTitle = '' 16 channelLinkTitle = ''
16 accountLinkTitle = '' 17 accountLinkTitle = ''
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.html b/client/src/app/+videos/+video-watch/video-watch.component.html
index 45cfba167..df74a818b 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.html
+++ b/client/src/app/+videos/+video-watch/video-watch.component.html
@@ -60,7 +60,7 @@
60 60
61 <div class="pt-3 border-top video-info-channel d-flex"> 61 <div class="pt-3 border-top video-info-channel d-flex">
62 <div class="video-info-channel-left d-flex"> 62 <div class="video-info-channel-left d-flex">
63 <my-video-avatar-channel [video]="video" [genericChannel]="isChannelDisplayNameGeneric()"></my-video-avatar-channel> 63 <my-video-avatar-channel [video]="video" [showChannel]="!isChannelDisplayNameGeneric()"></my-video-avatar-channel>
64 64
65 <div class="video-info-channel-left-links ml-1"> 65 <div class="video-info-channel-left-links ml-1">
66 <ng-container *ngIf="!isChannelDisplayNameGeneric()"> 66 <ng-container *ngIf="!isChannelDisplayNameGeneric()">
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 f51c298f2..b12495f90 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
@@ -39,10 +39,10 @@
39 </span> 39 </span>
40 40
41 <a tabindex="-1" *ngIf="displayOptions.by && displayOwnerAccount()" class="video-miniature-account" [routerLink]="[ '/c', video.byVideoChannel ]"> 41 <a tabindex="-1" *ngIf="displayOptions.by && displayOwnerAccount()" class="video-miniature-account" [routerLink]="[ '/c', video.byVideoChannel ]">
42 {{ video.byAccount }} 42 {{ authorAccount }}
43 </a> 43 </a>
44 <a tabindex="-1" *ngIf="displayOptions.by && displayOwnerVideoChannel()" class="video-miniature-channel" [routerLink]="[ '/c', video.byVideoChannel ]"> 44 <a tabindex="-1" *ngIf="displayOptions.by && displayOwnerVideoChannel()" class="video-miniature-channel" [routerLink]="[ '/c', video.byVideoChannel ]">
45 {{ video.byVideoChannel }} 45 {{ authorChannel }}
46 </a> 46 </a>
47 47
48 <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 cb81ba3bd..69f00fb10 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
@@ -100,6 +100,14 @@ export class VideoMiniatureComponent implements OnInit {
100 @Inject(LOCALE_ID) private localeId: string 100 @Inject(LOCALE_ID) private localeId: string
101 ) {} 101 ) {}
102 102
103 get authorAccount () {
104 return this.serverConfig.client.videos.miniature.showAuthorDisplayName ? this.video.account.displayName : this.video.byAccount
105 }
106
107 get authorChannel () {
108 return this.serverConfig.client.videos.miniature.showAuthorDisplayName ? this.video.channel.displayName : this.video.byVideoChannel
109 }
110
103 get isVideoBlur () { 111 get isVideoBlur () {
104 return this.video.isVideoNSFWForUser(this.user, this.serverConfig) 112 return this.video.isVideoNSFWForUser(this.user, this.serverConfig)
105 } 113 }
diff --git a/config/default.yaml b/config/default.yaml
index 707187b7c..dec34affd 100644
--- a/config/default.yaml
+++ b/config/default.yaml
@@ -75,6 +75,11 @@ email:
75 subject: 75 subject:
76 prefix: "[PeerTube]" 76 prefix: "[PeerTube]"
77 77
78client:
79 videos:
80 miniature:
81 show_author_display_name: false
82
78# From the project root directory 83# From the project root directory
79storage: 84storage:
80 tmp: 'storage/tmp/' # Use to download data (imports etc), store uploaded files before and during processing... 85 tmp: 'storage/tmp/' # Use to download data (imports etc), store uploaded files before and during processing...
diff --git a/config/production.yaml.example b/config/production.yaml.example
index e405daa71..a55c99eaa 100644
--- a/config/production.yaml.example
+++ b/config/production.yaml.example
@@ -73,6 +73,11 @@ email:
73 subject: 73 subject:
74 prefix: "[PeerTube]" 74 prefix: "[PeerTube]"
75 75
76client:
77 videos:
78 miniature:
79 show_author_display_name: false
80
76# From the project root directory 81# From the project root directory
77storage: 82storage:
78 tmp: '/var/www/peertube/storage/tmp/' # Use to download data (imports etc), store uploaded files before and during processing... 83 tmp: '/var/www/peertube/storage/tmp/' # Use to download data (imports etc), store uploaded files before and during processing...
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index b2a8e9e19..5ee08cf12 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -58,6 +58,15 @@ const CONFIG = {
58 PREFIX: config.get<string>('email.subject.prefix') + ' ' 58 PREFIX: config.get<string>('email.subject.prefix') + ' '
59 } 59 }
60 }, 60 },
61
62 CLIENT: {
63 VIDEOS: {
64 MINIATURE: {
65 get SHOW_AUTHOR_DISPLAY_NAME () { return config.get<boolean>('client.videos.miniature.show_author_display_name') }
66 }
67 }
68 },
69
61 STORAGE: { 70 STORAGE: {
62 TMP_DIR: buildPath(config.get<string>('storage.tmp')), 71 TMP_DIR: buildPath(config.get<string>('storage.tmp')),
63 ACTOR_IMAGES: buildPath(config.get<string>('storage.avatars')), 72 ACTOR_IMAGES: buildPath(config.get<string>('storage.avatars')),
diff --git a/server/lib/server-config-manager.ts b/server/lib/server-config-manager.ts
index 358f47133..72fcf54cd 100644
--- a/server/lib/server-config-manager.ts
+++ b/server/lib/server-config-manager.ts
@@ -43,6 +43,13 @@ class ServerConfigManager {
43 43
44 return { 44 return {
45 allowEdits: CONFIG.WEBADMIN.CONFIGURATION.EDITS.ALLOWED, 45 allowEdits: CONFIG.WEBADMIN.CONFIGURATION.EDITS.ALLOWED,
46 client: {
47 videos: {
48 miniature: {
49 showAuthorDisplayName: CONFIG.CLIENT.VIDEOS.MINIATURE.SHOW_AUTHOR_DISPLAY_NAME
50 }
51 }
52 },
46 instance: { 53 instance: {
47 name: CONFIG.INSTANCE.NAME, 54 name: CONFIG.INSTANCE.NAME,
48 shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION, 55 shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION,
diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts
index 3b026e3a5..df9380844 100644
--- a/shared/models/server/server-config.model.ts
+++ b/shared/models/server/server-config.model.ts
@@ -34,6 +34,14 @@ export interface ServerConfig {
34 serverVersion: string 34 serverVersion: string
35 serverCommit?: string 35 serverCommit?: string
36 36
37 client: {
38 videos: {
39 miniature: {
40 showAuthorDisplayName: boolean
41 }
42 }
43 }
44
37 instance: { 45 instance: {
38 name: string 46 name: string
39 shortDescription: string 47 shortDescription: string