add option to always show channel display name

closes #4040
pull/4422/head
kontrollanten 2021-09-20 10:25:29 +02:00
parent 4d3e611dd2
commit 46ed55544c
12 changed files with 51 additions and 31 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,19 +60,19 @@
<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>

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

View File

@ -39,10 +39,10 @@
</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">

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

View 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

View 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

View 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: {

View 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: {

View File

@ -43,6 +43,8 @@ export interface ServerConfig {
javascript: string
css: string
}
onlyShowAuthorChannel: boolean
showAuthorDisplayNameInMiniatures: boolean
}
search: {