Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

add option to always show channel display name (#4422)

kontrollanten7399a79f73cc
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 5a72218584..d433c7abaf 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 @@
-<div class="wrapper" [ngClass]="{ 'generic-channel': genericChannel }">
+<div class="wrapper">
<my-actor-avatar
- class="channel" [channel]="video.channel"
- [internalHref]="[ '/c', video.byVideoChannel ]" [title]="channelLinkTitle"
+ *ngIf="showChannel"
+ class="channel"
+ [class.main-avatar]="showChannel"
+ [channel]="video.channel"
+ [internalHref]="[ '/c', video.byVideoChannel ]"
+ [title]="channelLinkTitle"
></my-actor-avatar>
<my-actor-avatar
- class="account" [account]="video.account"
- [internalHref]="[ '/a', video.byAccount ]" [title]="accountLinkTitle">
+ *ngIf="showAccount"
+ class="account"
+ [class.main-avatar]="!showChannel"
+ [class.second-avatar]="showChannel"
+ [account]="video.account"
+ [internalHref]="[ '/a', video.byAccount ]"
+ [title]="accountLinkTitle">
</my-actor-avatar>
</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 1ff8fb96eb..71c5e4b5a3 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 @@
position: relative;
margin-bottom: 5px;
- &.generic-channel {
- .account {
- @include main();
- }
-
- .channel {
- display: none !important;
- }
+ .main-avatar {
+ @include main();
}
- &:not(.generic-channel) {
- .account {
- @include secondary();
- }
-
- .channel {
- @include main();
- }
+ .second-avatar {
+ @include secondary();
}
}
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 63edd7badf..146c440b39 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 {
@Input() video: Video
@Input() byAccount: string
- @Input() genericChannel: boolean
+ @Input() showAccount: boolean
+ @Input() showChannel: boolean
channelLinkTitle = ''
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 45cfba167c..df74a818b6 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 @@
<div class="pt-3 border-top video-info-channel d-flex">
<div class="video-info-channel-left d-flex">
- <my-video-avatar-channel [video]="video" [genericChannel]="isChannelDisplayNameGeneric()"></my-video-avatar-channel>
+ <my-video-avatar-channel [video]="video" [showChannel]="!isChannelDisplayNameGeneric()"></my-video-avatar-channel>
<div class="video-info-channel-left-links ml-1">
<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 f51c298f20..b12495f907 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 @@
</span>
<a tabindex="-1" *ngIf="displayOptions.by && displayOwnerAccount()" class="video-miniature-account" [routerLink]="[ '/c', video.byVideoChannel ]">
- {{ video.byAccount }}
+ {{ authorAccount }}
</a>
<a tabindex="-1" *ngIf="displayOptions.by && displayOwnerVideoChannel()" class="video-miniature-channel" [routerLink]="[ '/c', video.byVideoChannel ]">
- {{ video.byVideoChannel }}
+ {{ authorChannel }}
</a>
<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 cb81ba3bd7..69f00fb101 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 {
@Inject(LOCALE_ID) private localeId: string
) {}
+ get authorAccount () {
+ return this.serverConfig.client.videos.miniature.showAuthorDisplayName ? this.video.account.displayName : this.video.byAccount
+ }
+
+ get authorChannel () {
+ return this.serverConfig.client.videos.miniature.showAuthorDisplayName ? this.video.channel.displayName : this.video.byVideoChannel
+ }
+
get isVideoBlur () {
return this.video.isVideoNSFWForUser(this.user, this.serverConfig)
}
diff --git a/config/default.yaml b/config/default.yaml
index 707187b7c1..dec34affdb 100644
--- a/config/default.yaml
+++ b/config/default.yaml
@@ -75,6 +75,11 @@ email:
subject:
prefix: "[PeerTube]"
+client:
+ videos:
+ miniature:
+ show_author_display_name: false
+
# From the project root directory
storage:
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 e405daa712..a55c99eaa9 100644
--- a/config/production.yaml.example
+++ b/config/production.yaml.example
@@ -73,6 +73,11 @@ email:
subject:
prefix: "[PeerTube]"
+client:
+ videos:
+ miniature:
+ show_author_display_name: false
+
# From the project root directory
storage:
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 b2a8e9e199..5ee08cf121 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -58,6 +58,15 @@ const CONFIG = {
PREFIX: config.get<string>('email.subject.prefix') + ' '
}
},
+
+ CLIENT: {
+ VIDEOS: {
+ MINIATURE: {
+ get SHOW_AUTHOR_DISPLAY_NAME () { return config.get<boolean>('client.videos.miniature.show_author_display_name') }
+ }
+ }
+ },
+
STORAGE: {
TMP_DIR: buildPath(config.get<string>('storage.tmp')),
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 358f47133c..72fcf54cd0 100644
--- a/server/lib/server-config-manager.ts
+++ b/server/lib/server-config-manager.ts
@@ -43,6 +43,13 @@ class ServerConfigManager {
return {
allowEdits: CONFIG.WEBADMIN.CONFIGURATION.EDITS.ALLOWED,
+ client: {
+ videos: {
+ miniature: {
+ showAuthorDisplayName: CONFIG.CLIENT.VIDEOS.MINIATURE.SHOW_AUTHOR_DISPLAY_NAME
+ }
+ }
+ },
instance: {
name: CONFIG.INSTANCE.NAME,
shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION,
diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts
index 3b026e3a53..df9380844c 100644
--- a/shared/models/server/server-config.model.ts
+++ b/shared/models/server/server-config.model.ts
@@ -34,6 +34,14 @@ export interface ServerConfig {
serverVersion: string
serverCommit?: string
+ client: {
+ videos: {
+ miniature: {
+ showAuthorDisplayName: boolean
+ }
+ }
+ }
+
instance: {
name: string
shortDescription: string