aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorKim <1877318+kimsible@users.noreply.github.com>2020-07-24 08:49:59 +0200
committerGitHub <noreply@github.com>2020-07-24 08:49:59 +0200
commitb40a219338fed042072decea203838ca5e2b265f (patch)
treefe52c722d48e7d8920118d1e2e78e7f96a995e67 /client/src/app
parente13d7ae45c4f30f0146edfba3674d8ef0eccac99 (diff)
downloadPeerTube-b40a219338fed042072decea203838ca5e2b265f.tar.gz
PeerTube-b40a219338fed042072decea203838ca5e2b265f.tar.zst
PeerTube-b40a219338fed042072decea203838ca5e2b265f.zip
Hide generic channel display name and avatar on watch view (#2988)
* Hide generic channel display name on watch view * Hide generic channel avatar on watch view * Add Default username channel as a generic channel display-name Co-authored-by: kimsible <kimsible@users.noreply.github.com>
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.html22
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.scss4
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.ts9
-rw-r--r--client/src/app/shared/shared-main/account/avatar.component.html30
-rw-r--r--client/src/app/shared/shared-main/account/avatar.component.ts5
5 files changed, 57 insertions, 13 deletions
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.html b/client/src/app/+videos/+video-watch/video-watch.component.html
index 0447268f0..fb6d08167 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.html
+++ b/client/src/app/+videos/+video-watch/video-watch.component.html
@@ -144,15 +144,23 @@
144 144
145 <div class="pt-3 border-top video-info-channel d-flex"> 145 <div class="pt-3 border-top video-info-channel d-flex">
146 <div class="video-info-channel-left d-flex"> 146 <div class="video-info-channel-left d-flex">
147 <avatar-channel [video]="video"></avatar-channel> 147 <avatar-channel [video]="video" [genericChannel]="isChannelDisplayNameGeneric()"></avatar-channel>
148 148
149 <div class="video-info-channel-left-links ml-1"> 149 <div class="video-info-channel-left-links ml-1">
150 <a [routerLink]="[ '/video-channels', video.byVideoChannel ]" i18n-title title="Channel page"> 150 <ng-container *ngIf="!isChannelDisplayNameGeneric()">
151 {{ video.channel.displayName }} 151 <a [routerLink]="[ '/video-channels', video.byVideoChannel ]" i18n-title title="Channel page">
152 </a> 152 {{ video.channel.displayName }}
153 <a [routerLink]="[ '/accounts', video.byAccount ]" i18n-title title="Account page"> 153 </a>
154 <span i18n>By {{ video.byAccount }}</span> 154 <a [routerLink]="[ '/accounts', video.byAccount ]" i18n-title title="Account page">
155 </a> 155 <span i18n>By {{ video.byAccount }}</span>
156 </a>
157 </ng-container>
158
159 <ng-container *ngIf="isChannelDisplayNameGeneric()">
160 <a [routerLink]="[ '/accounts', video.byAccount ]" class="single-link" i18n-title title="Account page">
161 <span i18n>{{ video.byAccount }}</span>
162 </a>
163 </ng-container>
156 </div> 164 </div>
157 </div> 165 </div>
158 166
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.scss b/client/src/app/+videos/+video-watch/video-watch.component.scss
index c7f91f4a0..00a4b0dee 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.scss
+++ b/client/src/app/+videos/+video-watch/video-watch.component.scss
@@ -192,6 +192,10 @@ $video-info-margin-left: 44px;
192 font-weight: 500; 192 font-weight: 500;
193 font-size: 90%; 193 font-size: 90%;
194 } 194 }
195
196 a.single-link {
197 margin-top: 7px;
198 }
195 } 199 }
196 } 200 }
197 201
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts
index 933e6c51f..4341514cd 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/+videos/+video-watch/video-watch.component.ts
@@ -307,6 +307,15 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
307 ) 307 )
308 } 308 }
309 309
310 isChannelDisplayNameGeneric () {
311 const genericChannelDisplayName = [
312 `Main ${this.video.channel.ownerAccount.name} channel`,
313 `Default ${this.video.channel.ownerAccount.name} channel`
314 ]
315
316 return genericChannelDisplayName.includes(this.video.channel.displayName)
317 }
318
310 private loadVideo (videoId: string) { 319 private loadVideo (videoId: string) {
311 // Video did not change 320 // Video did not change
312 if (this.video && this.video.uuid === videoId) return 321 if (this.video && this.video.uuid === videoId) return
diff --git a/client/src/app/shared/shared-main/account/avatar.component.html b/client/src/app/shared/shared-main/account/avatar.component.html
index 09871fca4..310cc926f 100644
--- a/client/src/app/shared/shared-main/account/avatar.component.html
+++ b/client/src/app/shared/shared-main/account/avatar.component.html
@@ -1,8 +1,26 @@
1<div class="wrapper" [ngClass]="'avatar-' + size"> 1<div class="wrapper" [ngClass]="'avatar-' + size">
2 <a [routerLink]="[ '/video-channels', video.byVideoChannel ]" [title]="channelLinkTitle"> 2 <ng-container *ngIf="!isChannelAvatarNull() && !genericChannel">
3 <img [src]="video.videoChannelAvatarUrl" i18n-alt alt="Channel avatar" /> 3 <a [routerLink]="[ '/video-channels', video.byVideoChannel ]" [title]="channelLinkTitle">
4 </a> 4 <img [src]="video.videoChannelAvatarUrl" i18n-alt alt="Channel avatar" />
5 <a [routerLink]="[ '/accounts', video.byAccount ]" [title]="accountLinkTitle"> 5 </a>
6 <img [src]="video.accountAvatarUrl" i18n-alt alt="Account avatar" /> 6 <a [routerLink]="[ '/accounts', video.byAccount ]" [title]="accountLinkTitle">
7 </a> 7 <img [src]="video.accountAvatarUrl" i18n-alt alt="Account avatar" />
8 </a>
9 </ng-container>
10
11 <ng-container *ngIf="!isChannelAvatarNull() && genericChannel">
12 <a [routerLink]="[ '/accounts', video.byAccount ]" [title]="accountLinkTitle">
13 <img [src]="video.accountAvatarUrl" i18n-alt alt="Account avatar" />
14 </a>
15
16 <a [routerLink]="[ '/video-channels', video.byVideoChannel ]" [title]="channelLinkTitle">
17 <img [src]="video.videoChannelAvatarUrl" i18n-alt alt="Channel avatar" />
18 </a>
19 </ng-container>
20
21 <ng-container *ngIf="isChannelAvatarNull()">
22 <a [routerLink]="[ '/accounts', video.byAccount ]" [title]="accountLinkTitle">
23 <img [src]="video.accountAvatarUrl" i18n-alt alt="Account avatar" />
24 </a>
25 </ng-container>
8</div> 26</div>
diff --git a/client/src/app/shared/shared-main/account/avatar.component.ts b/client/src/app/shared/shared-main/account/avatar.component.ts
index 31f39c200..73c145ef9 100644
--- a/client/src/app/shared/shared-main/account/avatar.component.ts
+++ b/client/src/app/shared/shared-main/account/avatar.component.ts
@@ -10,6 +10,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
10export class AvatarComponent implements OnInit { 10export class AvatarComponent implements OnInit {
11 @Input() video: Video 11 @Input() video: Video
12 @Input() size: 'md' | 'sm' = 'md' 12 @Input() size: 'md' | 'sm' = 'md'
13 @Input() genericChannel: boolean
13 14
14 channelLinkTitle = '' 15 channelLinkTitle = ''
15 accountLinkTitle = '' 16 accountLinkTitle = ''
@@ -28,4 +29,8 @@ export class AvatarComponent implements OnInit {
28 { name: this.video.account.name, handle: this.video.byAccount } 29 { name: this.video.account.name, handle: this.video.byAccount }
29 ) 30 )
30 } 31 }
32
33 isChannelAvatarNull () {
34 return this.video.channel.avatar === null
35 }
31} 36}