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
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>

View File

@ -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();
}
}

View 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 = ''

View 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()">

View File

@ -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">

View 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)
}

View 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...

View 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...

View 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')),

View 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,

View File

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