]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
add option to always show channel display name
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>
Mon, 20 Sep 2021 08:25:29 +0000 (10:25 +0200)
committerkontrollanten <6680299+kontrollanten@users.noreply.github.com>
Mon, 20 Sep 2021 08:40:12 +0000 (10:40 +0200)
closes #4040

12 files changed:
client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.html
client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.scss
client/src/app/+videos/+video-watch/shared/metadata/video-avatar-channel.component.ts
client/src/app/+videos/+video-watch/video-watch.component.html
client/src/app/+videos/+video-watch/video-watch.component.ts
client/src/app/shared/shared-video-miniature/video-miniature.component.html
client/src/app/shared/shared-video-miniature/video-miniature.component.ts
config/default.yaml
config/production.yaml.example
server/initializers/config.ts
server/lib/server-config-manager.ts
shared/models/server/server-config.model.ts

index 5a722185848a2ed11ed2e25a574c0890ef0ded76..d433c7abaf6acaa9aeeb250d8b1e7c0d3c407da7 100644 (file)
@@ -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>
index 1ff8fb96eb96d2bbe90b27226e11ddfd63729ccf..71c5e4b5a3bcb6fb98f18317039d1b10ab93f6a6 100644 (file)
   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();
   }
 }
index 63edd7badff7a3183bd954c2643b6252b8e8a647..146c440b39df3736746302b2df237cd3b8a1d92a 100644 (file)
@@ -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 = ''
index 45cfba167cc25ba171aa5efc98e86294fb3a0261..763c80e54fe9186b5083fee1f3b0c6cb6938202d 100644 (file)
 
           <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" [showAccount]="!onlyShowAuthorChannel" [showChannel]="!isChannelDisplayNameGeneric() || onlyShowAuthorChannel"></my-video-avatar-channel>
 
               <div class="video-info-channel-left-links ml-1">
-                <ng-container *ngIf="!isChannelDisplayNameGeneric()">
-                  <a [routerLink]="[ '/c', video.byVideoChannel ]" i18n-title title="Channel page">
+                <ng-container *ngIf="!isChannelDisplayNameGeneric() || onlyShowAuthorChannel">
+                  <a [routerLink]="[ '/c', video.byVideoChannel ]" i18n-title title="Channel page" [class.single-link]="onlyShowAuthorChannel">
                     {{ video.channel.displayName }}
                   </a>
-                  <a [routerLink]="[ '/a', video.byAccount ]" i18n-title title="Account page">
+                  <a [routerLink]="[ '/a', video.byAccount ]" i18n-title title="Account page" *ngIf="!onlyShowAuthorChannel">
                     <span i18n>By {{ video.byAccount }}</span>
                   </a>
                 </ng-container>
 
-                <ng-container *ngIf="isChannelDisplayNameGeneric()">
+                <ng-container *ngIf="isChannelDisplayNameGeneric() && !onlyShowAuthorChannel">
                   <a [routerLink]="[ '/a', video.byAccount ]" class="single-link" i18n-title title="Account page">
                     <span i18n>{{ video.byAccount }}</span>
                   </a>
index acfd46a41a32249c9cad10457a23c42e728bbd09..614a9124fbd20225228e1e68ff145f2a54ed33e3 100644 (file)
@@ -67,6 +67,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
 
   remoteServerDown = false
 
+  onlyShowAuthorChannel: boolean
+
   private nextVideoUUID = ''
   private nextVideoTitle = ''
 
@@ -116,6 +118,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
   ngOnInit () {
     this.serverConfig = this.serverService.getHTMLConfig()
 
+    this.onlyShowAuthorChannel = this.serverConfig.instance.onlyShowAuthorChannel
+
     PeertubePlayerManager.initState()
 
     this.loadRouteParams()
index f51c298f20a34af9311813fff42b078b0332f4f0..4befd07064a9cdba686d215661549b49a644b95a 100644 (file)
           </span>
 
           <a tabindex="-1" *ngIf="displayOptions.by && displayOwnerAccount()" class="video-miniature-account" [routerLink]="[ '/c', video.byVideoChannel ]">
-            {{ video.byAccount }}
+            {{ serverConfig.instance.showAuthorDisplayNameInMiniatures ? video.account.displayName : video.byAccount }}
           </a>
           <a tabindex="-1" *ngIf="displayOptions.by && displayOwnerVideoChannel()" class="video-miniature-channel" [routerLink]="[ '/c', video.byVideoChannel ]">
-            {{ video.byVideoChannel }}
+            {{ serverConfig.instance.showAuthorDisplayNameInMiniatures ? video.channel.displayName : video.byVideoChannel }}
           </a>
 
           <div class="video-info-privacy">
index cb81ba3bd7ef1348cf21622173b9ff73d5c6dc06..6e9d4f16298a2ed77227ae810e0c0d13e761e78d 100644 (file)
@@ -240,6 +240,11 @@ export class VideoMiniatureComponent implements OnInit {
   }
 
   private setUpBy () {
+    if (this.serverConfig.instance.onlyShowAuthorChannel === true) {
+      this.ownerDisplayType = 'videoChannel'
+      return
+    }
+
     const accountName = this.video.account.name
 
     // If the video channel name is an UUID (not really displayable, we changed this behaviour in v1.0.0-beta.12)
index 3865ab5cf19720e5f8016bebbf36837964ce1f78..4b76bc1875a0a09eea52f3d2951415de55cba882 100644 (file)
@@ -399,6 +399,9 @@ instance:
   terms: 'No terms for now.' # Support markdown
   code_of_conduct: '' # Supports markdown
 
+  only_show_channel_author: false
+  show_author_display_name_in_miniatures: false
+
   # Who moderates the instance? What is the policy regarding NSFW videos? Political videos? etc
   moderation_information: '' # Supports markdown
 
index 94238fad00f6bb70a968b28d45d2d5f2e1cc4059..3cfb9830050fdada2bfaab95dcdb9cc0738a01a0 100644 (file)
@@ -409,6 +409,9 @@ instance:
   terms: 'No terms for now.' # Support markdown
   code_of_conduct: '' # Supports markdown
 
+  only_show_channel_author: false
+  show_author_display_name_in_miniatures: false
+
   # Who moderates the instance? What is the policy regarding NSFW videos? Political videos? etc
   moderation_information: '' # Supports markdown
 
index be9fc61f083a43be735410f93eab0a01c33ef992..289e9fe429b842a8343896714ad8e7b7ebc5805c 100644 (file)
@@ -334,7 +334,10 @@ const CONFIG = {
     },
     get ROBOTS () { return config.get<string>('instance.robots') },
     get SECURITYTXT () { return config.get<string>('instance.securitytxt') },
-    get SECURITYTXT_CONTACT () { return config.get<string>('admin.email') }
+    get SECURITYTXT_CONTACT () { return config.get<string>('admin.email') },
+
+    get ONLY_SHOW_CHANNEL_AUTHOR () { return config.get<boolean>('instance.only_show_channel_author') },
+    get SHOW_AUTHOR_DISPLAY_NAME_IN_MINIATURES () { return config.get<boolean>('instance.show_author_display_name_in_miniatures') }
   },
   SERVICES: {
     TWITTER: {
index 80d87a9d343af15eca9df627112fb0c72aa68c03..fe89cee4c0d6cfc6707f5a144c2d7ed44084484c 100644 (file)
@@ -51,7 +51,9 @@ class ServerConfigManager {
         customizations: {
           javascript: CONFIG.INSTANCE.CUSTOMIZATIONS.JAVASCRIPT,
           css: CONFIG.INSTANCE.CUSTOMIZATIONS.CSS
-        }
+        },
+        onlyShowAuthorChannel: CONFIG.INSTANCE.ONLY_SHOW_CHANNEL_AUTHOR,
+        showAuthorDisplayNameInMiniatures: CONFIG.INSTANCE.SHOW_AUTHOR_DISPLAY_NAME_IN_MINIATURES
       },
       search: {
         remoteUri: {
index 585e99acaca85648e48ef3c59e8ec78db6e1a74c..faa72c3dbbb082029249ed933f1ce82ff1b0a57c 100644 (file)
@@ -43,6 +43,8 @@ export interface ServerConfig {
       javascript: string
       css: string
     }
+    onlyShowAuthorChannel: boolean
+    showAuthorDisplayNameInMiniatures: boolean
   }
 
   search: {