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 79b1a84140.

* channel display name: fix review comments
This commit is contained in:
kontrollanten 2021-10-12 14:23:44 +02:00 committed by GitHub
parent 10ef089102
commit 7399a79f73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 65 additions and 25 deletions

View File

@ -1,11 +1,20 @@
<div class="wrapper" [ngClass]="{ 'generic-channel': genericChannel }"> <div class="wrapper">
<my-actor-avatar <my-actor-avatar
class="channel" [channel]="video.channel" *ngIf="showChannel"
[internalHref]="[ '/c', video.byVideoChannel ]" [title]="channelLinkTitle" class="channel"
[class.main-avatar]="showChannel"
[channel]="video.channel"
[internalHref]="[ '/c', video.byVideoChannel ]"
[title]="channelLinkTitle"
></my-actor-avatar> ></my-actor-avatar>
<my-actor-avatar <my-actor-avatar
class="account" [account]="video.account" *ngIf="showAccount"
[internalHref]="[ '/a', video.byAccount ]" [title]="accountLinkTitle"> class="account"
[class.main-avatar]="!showChannel"
[class.second-avatar]="showChannel"
[account]="video.account"
[internalHref]="[ '/a', video.byAccount ]"
[title]="accountLinkTitle">
</my-actor-avatar> </my-actor-avatar>
</div> </div>

View File

@ -20,23 +20,11 @@
position: relative; position: relative;
margin-bottom: 5px; margin-bottom: 5px;
&.generic-channel { .main-avatar {
.account { @include main();
@include main();
}
.channel {
display: none !important;
}
} }
&:not(.generic-channel) { .second-avatar {
.account { @include secondary();
@include secondary();
}
.channel {
@include main();
}
} }
} }

View File

@ -10,7 +10,8 @@ export class VideoAvatarChannelComponent implements OnInit {
@Input() video: Video @Input() video: Video
@Input() byAccount: string @Input() byAccount: string
@Input() genericChannel: boolean @Input() showAccount: boolean
@Input() showChannel: boolean
channelLinkTitle = '' channelLinkTitle = ''
accountLinkTitle = '' accountLinkTitle = ''

View File

@ -60,7 +60,7 @@
<div class="pt-3 border-top video-info-channel d-flex"> <div class="pt-3 border-top video-info-channel d-flex">
<div class="video-info-channel-left 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"> <div class="video-info-channel-left-links ml-1">
<ng-container *ngIf="!isChannelDisplayNameGeneric()"> <ng-container *ngIf="!isChannelDisplayNameGeneric()">

View File

@ -39,10 +39,10 @@
</span> </span>
<a tabindex="-1" *ngIf="displayOptions.by && displayOwnerAccount()" class="video-miniature-account" [routerLink]="[ '/c', video.byVideoChannel ]"> <a tabindex="-1" *ngIf="displayOptions.by && displayOwnerAccount()" class="video-miniature-account" [routerLink]="[ '/c', video.byVideoChannel ]">
{{ video.byAccount }} {{ authorAccount }}
</a> </a>
<a tabindex="-1" *ngIf="displayOptions.by && displayOwnerVideoChannel()" class="video-miniature-channel" [routerLink]="[ '/c', video.byVideoChannel ]"> <a tabindex="-1" *ngIf="displayOptions.by && displayOwnerVideoChannel()" class="video-miniature-channel" [routerLink]="[ '/c', video.byVideoChannel ]">
{{ video.byVideoChannel }} {{ authorChannel }}
</a> </a>
<div class="video-info-privacy"> <div class="video-info-privacy">

View File

@ -100,6 +100,14 @@ export class VideoMiniatureComponent implements OnInit {
@Inject(LOCALE_ID) private localeId: string @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 () { get isVideoBlur () {
return this.video.isVideoNSFWForUser(this.user, this.serverConfig) return this.video.isVideoNSFWForUser(this.user, this.serverConfig)
} }

View File

@ -75,6 +75,11 @@ email:
subject: subject:
prefix: "[PeerTube]" prefix: "[PeerTube]"
client:
videos:
miniature:
show_author_display_name: false
# From the project root directory # From the project root directory
storage: storage:
tmp: 'storage/tmp/' # Use to download data (imports etc), store uploaded files before and during processing... tmp: 'storage/tmp/' # Use to download data (imports etc), store uploaded files before and during processing...

View File

@ -73,6 +73,11 @@ email:
subject: subject:
prefix: "[PeerTube]" prefix: "[PeerTube]"
client:
videos:
miniature:
show_author_display_name: false
# From the project root directory # From the project root directory
storage: storage:
tmp: '/var/www/peertube/storage/tmp/' # Use to download data (imports etc), store uploaded files before and during processing... tmp: '/var/www/peertube/storage/tmp/' # Use to download data (imports etc), store uploaded files before and during processing...

View File

@ -58,6 +58,15 @@ const CONFIG = {
PREFIX: config.get<string>('email.subject.prefix') + ' ' 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: { STORAGE: {
TMP_DIR: buildPath(config.get<string>('storage.tmp')), TMP_DIR: buildPath(config.get<string>('storage.tmp')),
ACTOR_IMAGES: buildPath(config.get<string>('storage.avatars')), ACTOR_IMAGES: buildPath(config.get<string>('storage.avatars')),

View File

@ -43,6 +43,13 @@ class ServerConfigManager {
return { return {
allowEdits: CONFIG.WEBADMIN.CONFIGURATION.EDITS.ALLOWED, allowEdits: CONFIG.WEBADMIN.CONFIGURATION.EDITS.ALLOWED,
client: {
videos: {
miniature: {
showAuthorDisplayName: CONFIG.CLIENT.VIDEOS.MINIATURE.SHOW_AUTHOR_DISPLAY_NAME
}
}
},
instance: { instance: {
name: CONFIG.INSTANCE.NAME, name: CONFIG.INSTANCE.NAME,
shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION, shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION,

View File

@ -34,6 +34,14 @@ export interface ServerConfig {
serverVersion: string serverVersion: string
serverCommit?: string serverCommit?: string
client: {
videos: {
miniature: {
showAuthorDisplayName: boolean
}
}
}
instance: { instance: {
name: string name: string
shortDescription: string shortDescription: string