]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
add option to always show channel display name (#4422)
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>
Tue, 12 Oct 2021 12:23:44 +0000 (14:23 +0200)
committerGitHub <noreply@github.com>
Tue, 12 Oct 2021 12:23:44 +0000 (14:23 +0200)
* 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

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/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..df74a818b662c0874f87d33248cf923d9f4ea594 100644 (file)
@@ -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()">
index f51c298f20a34af9311813fff42b078b0332f4f0..b12495f9077a2d35136544c7c34f5e8a739f157c 100644 (file)
           </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">
index cb81ba3bd7ef1348cf21622173b9ff73d5c6dc06..69f00fb1017d79d844b8e41ba81338a7551dafcf 100644 (file)
@@ -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)
   }
index 707187b7c177ce36a27bd4caf12da5485e70d025..dec34affdbf4ab6429d1e93dad9df5da8f459e57 100644 (file)
@@ -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...
index e405daa712f186330842d3eaf340a03afc57e5a9..a55c99eaa9d2f69084a51bedd05f5446e833ad66 100644 (file)
@@ -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...
index b2a8e9e199901c9d72382e6846fd2aa33c6a7f6e..5ee08cf1212486a58678572d1a20babcd50231bf 100644 (file)
@@ -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')),
index 358f47133ca4974f91d28b72a44b102b947ab138..72fcf54cd0285a35197a06c236e2825cd75b09a8 100644 (file)
@@ -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,
index 3b026e3a53e2586cc935352430b8459fcd58f182..df9380844cf8a1a4c263f02018b360d1ea1b40bb 100644 (file)
@@ -34,6 +34,14 @@ export interface ServerConfig {
   serverVersion: string
   serverCommit?: string
 
+  client: {
+    videos: {
+      miniature: {
+        showAuthorDisplayName: boolean
+      }
+    }
+  }
+
   instance: {
     name: string
     shortDescription: string