diff options
author | kontrollanten <6680299+kontrollanten@users.noreply.github.com> | 2021-04-15 10:01:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-15 10:01:27 +0200 |
commit | fbdcd4ec9f549b730f8311512bcc0c0b7bc2db0a (patch) | |
tree | e4c4d3a9abdc52afb2443234a57d74f0819b7d08 /client/src/app/shared | |
parent | 266947e5efc7ff30b0020beb5a74e4d4fc696fa5 (diff) | |
download | PeerTube-fbdcd4ec9f549b730f8311512bcc0c0b7bc2db0a.tar.gz PeerTube-fbdcd4ec9f549b730f8311512bcc0c0b7bc2db0a.tar.zst PeerTube-fbdcd4ec9f549b730f8311512bcc0c0b7bc2db0a.zip |
Add AccountAvatarComponent (#3965)
* refactor(client): create account-avatar component
* continue implement account-avatar
* fix review comments
Diffstat (limited to 'client/src/app/shared')
19 files changed, 111 insertions, 52 deletions
diff --git a/client/src/app/shared/shared-abuse-list/abuse-details.component.html b/client/src/app/shared/shared-abuse-list/abuse-details.component.html index fb8366f4c..658d42537 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-details.component.html +++ b/client/src/app/shared/shared-abuse-list/abuse-details.component.html | |||
@@ -10,12 +10,7 @@ | |||
10 | <a [routerLink]="[ baseRoute ]" [queryParams]="{ 'search': 'reporter:"' + abuse.reporterAccount.displayName + '"' }" | 10 | <a [routerLink]="[ baseRoute ]" [queryParams]="{ 'search': 'reporter:"' + abuse.reporterAccount.displayName + '"' }" |
11 | class="chip" | 11 | class="chip" |
12 | > | 12 | > |
13 | <img | 13 | <my-account-avatar [account]="abuse.reporterAccount"></my-account-avatar> |
14 | class="avatar" | ||
15 | [src]="abuse.reporterAccount.avatar?.path" | ||
16 | (error)="switchToDefaultAvatar($event)" | ||
17 | alt="Avatar" | ||
18 | > | ||
19 | <div> | 14 | <div> |
20 | <span class="text-muted">{{ abuse.reporterAccount.nameWithHost }}</span> | 15 | <span class="text-muted">{{ abuse.reporterAccount.nameWithHost }}</span> |
21 | </div> | 16 | </div> |
@@ -35,12 +30,7 @@ | |||
35 | <a [routerLink]="[ baseRoute ]" [queryParams]="{ 'search': 'reportee:"' +abuse.flaggedAccount.displayName + '"' }" | 30 | <a [routerLink]="[ baseRoute ]" [queryParams]="{ 'search': 'reportee:"' +abuse.flaggedAccount.displayName + '"' }" |
36 | class="chip" | 31 | class="chip" |
37 | > | 32 | > |
38 | <img | 33 | <my-account-avatar [account]="abuse.flaggedAccount"></my-account-avatar> |
39 | class="avatar" | ||
40 | [src]="abuse.flaggedAccount?.avatar?.path" | ||
41 | (error)="switchToDefaultAvatar($event)" | ||
42 | alt="Avatar" | ||
43 | > | ||
44 | <div> | 34 | <div> |
45 | <span class="text-muted">{{ abuse.flaggedAccount ? abuse.flaggedAccount.nameWithHost : '' }}</span> | 35 | <span class="text-muted">{{ abuse.flaggedAccount ? abuse.flaggedAccount.nameWithHost : '' }}</span> |
46 | </div> | 36 | </div> |
diff --git a/client/src/app/shared/shared-abuse-list/abuse-details.component.ts b/client/src/app/shared/shared-abuse-list/abuse-details.component.ts index 31cf3389d..e8ce7e678 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-details.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-details.component.ts | |||
@@ -45,8 +45,4 @@ export class AbuseDetailsComponent { | |||
45 | label: this.predefinedReasonsTranslations[r] | 45 | label: this.predefinedReasonsTranslations[r] |
46 | })) | 46 | })) |
47 | } | 47 | } |
48 | |||
49 | switchToDefaultAvatar ($event: Event) { | ||
50 | ($event.target as HTMLImageElement).src = Account.GET_DEFAULT_AVATAR_URL() | ||
51 | } | ||
52 | } | 48 | } |
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html index 8428032bf..29b51f09c 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html +++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html | |||
@@ -65,12 +65,7 @@ | |||
65 | <td *ngIf="isAdminView()"> | 65 | <td *ngIf="isAdminView()"> |
66 | <a *ngIf="abuse.reporterAccount" [href]="abuse.reporterAccount.url" i18n-title title="Open account in a new tab" target="_blank" rel="noopener noreferrer"> | 66 | <a *ngIf="abuse.reporterAccount" [href]="abuse.reporterAccount.url" i18n-title title="Open account in a new tab" target="_blank" rel="noopener noreferrer"> |
67 | <div class="chip two-lines"> | 67 | <div class="chip two-lines"> |
68 | <img | 68 | <my-account-avatar [account]="abuse.reporterAccount"></my-account-avatar> |
69 | class="avatar" | ||
70 | [src]="abuse.reporterAccount.avatar?.path" | ||
71 | (error)="switchToDefaultAvatar($event)" | ||
72 | alt="Avatar" | ||
73 | > | ||
74 | <div> | 69 | <div> |
75 | {{ abuse.reporterAccount.displayName }} | 70 | {{ abuse.reporterAccount.displayName }} |
76 | <span>{{ abuse.reporterAccount.nameWithHost }}</span> | 71 | <span>{{ abuse.reporterAccount.nameWithHost }}</span> |
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts index eeb9f128b..8b5771237 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts | |||
@@ -122,10 +122,6 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
122 | ) | 122 | ) |
123 | } | 123 | } |
124 | 124 | ||
125 | switchToDefaultAvatar ($event: Event) { | ||
126 | ($event.target as HTMLImageElement).src = Account.GET_DEFAULT_AVATAR_URL() | ||
127 | } | ||
128 | |||
129 | async removeAbuse (abuse: AdminAbuse) { | 125 | async removeAbuse (abuse: AdminAbuse) { |
130 | const res = await this.confirmService.confirm($localize`Do you really want to delete this abuse report?`, $localize`Delete`) | 126 | const res = await this.confirmService.confirm($localize`Do you really want to delete this abuse report?`, $localize`Delete`) |
131 | if (res === false) return | 127 | if (res === false) return |
diff --git a/client/src/app/shared/shared-abuse-list/shared-abuse-list.module.ts b/client/src/app/shared/shared-abuse-list/shared-abuse-list.module.ts index 663cd902b..19b6d456d 100644 --- a/client/src/app/shared/shared-abuse-list/shared-abuse-list.module.ts +++ b/client/src/app/shared/shared-abuse-list/shared-abuse-list.module.ts | |||
@@ -10,6 +10,7 @@ import { AbuseDetailsComponent } from './abuse-details.component' | |||
10 | import { AbuseListTableComponent } from './abuse-list-table.component' | 10 | import { AbuseListTableComponent } from './abuse-list-table.component' |
11 | import { AbuseMessageModalComponent } from './abuse-message-modal.component' | 11 | import { AbuseMessageModalComponent } from './abuse-message-modal.component' |
12 | import { ModerationCommentModalComponent } from './moderation-comment-modal.component' | 12 | import { ModerationCommentModalComponent } from './moderation-comment-modal.component' |
13 | import { SharedAccountAvatarModule } from '../shared-account-avatar/shared-account-avatar.module' | ||
13 | 14 | ||
14 | @NgModule({ | 15 | @NgModule({ |
15 | imports: [ | 16 | imports: [ |
@@ -19,7 +20,8 @@ import { ModerationCommentModalComponent } from './moderation-comment-modal.comp | |||
19 | SharedFormModule, | 20 | SharedFormModule, |
20 | SharedModerationModule, | 21 | SharedModerationModule, |
21 | SharedGlobalIconModule, | 22 | SharedGlobalIconModule, |
22 | SharedVideoCommentModule | 23 | SharedVideoCommentModule, |
24 | SharedAccountAvatarModule | ||
23 | ], | 25 | ], |
24 | 26 | ||
25 | declarations: [ | 27 | declarations: [ |
diff --git a/client/src/app/shared/shared-account-avatar/account-avatar.component.html b/client/src/app/shared/shared-account-avatar/account-avatar.component.html new file mode 100644 index 000000000..6bec0b5f3 --- /dev/null +++ b/client/src/app/shared/shared-account-avatar/account-avatar.component.html | |||
@@ -0,0 +1,8 @@ | |||
1 | <a *ngIf="account" [href]="href" target="_blank" rel="noopener noreferrer" [title]="title"> | ||
2 | <img | ||
3 | [class]="class" | ||
4 | [src]="avatarUrl" | ||
5 | i18n-alt | ||
6 | alt="Account avatar" | ||
7 | /> | ||
8 | </a> | ||
diff --git a/client/src/app/shared/shared-account-avatar/account-avatar.component.scss b/client/src/app/shared/shared-account-avatar/account-avatar.component.scss new file mode 100644 index 000000000..bb941d712 --- /dev/null +++ b/client/src/app/shared/shared-account-avatar/account-avatar.component.scss | |||
@@ -0,0 +1,22 @@ | |||
1 | @import '_variables'; | ||
2 | @import '_mixins'; | ||
3 | |||
4 | .avatar-25 { | ||
5 | @include avatar(25px); | ||
6 | } | ||
7 | |||
8 | .avatar-34 { | ||
9 | @include avatar(34px); | ||
10 | } | ||
11 | |||
12 | .avatar-36 { | ||
13 | @include avatar(36px); | ||
14 | } | ||
15 | |||
16 | .avatar-40 { | ||
17 | @include avatar(40px); | ||
18 | } | ||
19 | |||
20 | .avatar-120 { | ||
21 | @include avatar(120px); | ||
22 | } \ No newline at end of file | ||
diff --git a/client/src/app/shared/shared-account-avatar/account-avatar.component.ts b/client/src/app/shared/shared-account-avatar/account-avatar.component.ts new file mode 100644 index 000000000..d5533d459 --- /dev/null +++ b/client/src/app/shared/shared-account-avatar/account-avatar.component.ts | |||
@@ -0,0 +1,38 @@ | |||
1 | import { Component, Input } from '@angular/core' | ||
2 | import { Account as AccountInterface } from '@shared/models' | ||
3 | import { Account } from '../shared-main/account/account.model' | ||
4 | |||
5 | @Component({ | ||
6 | selector: 'my-account-avatar', | ||
7 | styleUrls: [ './account-avatar.component.scss' ], | ||
8 | templateUrl: './account-avatar.component.html' | ||
9 | }) | ||
10 | export class AccountAvatarComponent { | ||
11 | _href: string | ||
12 | _title: string | ||
13 | |||
14 | @Input() account: { name: string, avatar?: { url?: string }, url: string } | ||
15 | @Input() size = '36' | ||
16 | @Input() set href (value) { | ||
17 | this._href = value | ||
18 | } | ||
19 | @Input() set title (value) { | ||
20 | this._title = value | ||
21 | } | ||
22 | |||
23 | get href () { | ||
24 | return this._href || this.account?.url | ||
25 | } | ||
26 | |||
27 | get title () { | ||
28 | return this._title || $localize`${this.account.name} (account page)` | ||
29 | } | ||
30 | |||
31 | get class () { | ||
32 | return `avatar avatar-${this.size}` | ||
33 | } | ||
34 | |||
35 | get avatarUrl () { | ||
36 | return this.account?.avatar ? this.account.avatar.url : Account.GET_DEFAULT_AVATAR_URL() | ||
37 | } | ||
38 | } | ||
diff --git a/client/src/app/shared/shared-account-avatar/index.ts b/client/src/app/shared/shared-account-avatar/index.ts new file mode 100644 index 000000000..40c742ba5 --- /dev/null +++ b/client/src/app/shared/shared-account-avatar/index.ts | |||
@@ -0,0 +1,2 @@ | |||
1 | export * from './account-avatar.component' | ||
2 | export * from './shared-account-avatar.module' \ No newline at end of file | ||
diff --git a/client/src/app/shared/shared-account-avatar/shared-account-avatar.module.ts b/client/src/app/shared/shared-account-avatar/shared-account-avatar.module.ts new file mode 100644 index 000000000..17b27589f --- /dev/null +++ b/client/src/app/shared/shared-account-avatar/shared-account-avatar.module.ts | |||
@@ -0,0 +1,23 @@ | |||
1 | |||
2 | import { NgModule } from '@angular/core' | ||
3 | import { SharedGlobalIconModule } from '../shared-icons' | ||
4 | import { SharedMainModule } from '../shared-main/shared-main.module' | ||
5 | import { AccountAvatarComponent } from './account-avatar.component' | ||
6 | |||
7 | @NgModule({ | ||
8 | imports: [ | ||
9 | SharedMainModule, | ||
10 | SharedGlobalIconModule | ||
11 | ], | ||
12 | |||
13 | declarations: [ | ||
14 | AccountAvatarComponent | ||
15 | ], | ||
16 | |||
17 | exports: [ | ||
18 | AccountAvatarComponent | ||
19 | ], | ||
20 | |||
21 | providers: [ ] | ||
22 | }) | ||
23 | export class SharedAccountAvatarModule { } | ||
diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts index 1c2c4a575..14c507295 100644 --- a/client/src/app/shared/shared-main/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts | |||
@@ -20,7 +20,6 @@ export class Video implements VideoServerModel { | |||
20 | byVideoChannel: string | 20 | byVideoChannel: string |
21 | byAccount: string | 21 | byAccount: string |
22 | 22 | ||
23 | accountAvatarUrl: string | ||
24 | videoChannelAvatarUrl: string | 23 | videoChannelAvatarUrl: string |
25 | 24 | ||
26 | createdAt: Date | 25 | createdAt: Date |
@@ -144,7 +143,6 @@ export class Video implements VideoServerModel { | |||
144 | 143 | ||
145 | this.byAccount = Actor.CREATE_BY_STRING(hash.account.name, hash.account.host) | 144 | this.byAccount = Actor.CREATE_BY_STRING(hash.account.name, hash.account.host) |
146 | this.byVideoChannel = Actor.CREATE_BY_STRING(hash.channel.name, hash.channel.host) | 145 | this.byVideoChannel = Actor.CREATE_BY_STRING(hash.channel.name, hash.channel.host) |
147 | this.accountAvatarUrl = Account.GET_ACTOR_AVATAR_URL(this.account) | ||
148 | this.videoChannelAvatarUrl = VideoChannel.GET_ACTOR_AVATAR_URL(this.channel) | 146 | this.videoChannelAvatarUrl = VideoChannel.GET_ACTOR_AVATAR_URL(this.channel) |
149 | 147 | ||
150 | this.category.label = peertubeTranslate(this.category.label, translations) | 148 | this.category.label = peertubeTranslate(this.category.label, translations) |
diff --git a/client/src/app/shared/shared-moderation/account-blocklist.component.html b/client/src/app/shared/shared-moderation/account-blocklist.component.html index fb6f69cd5..3f2f55559 100644 --- a/client/src/app/shared/shared-moderation/account-blocklist.component.html +++ b/client/src/app/shared/shared-moderation/account-blocklist.component.html | |||
@@ -38,12 +38,7 @@ | |||
38 | <td> | 38 | <td> |
39 | <a [href]="accountBlock.blockedAccount.url" i18n-title title="Open account in a new tab" target="_blank" rel="noopener noreferrer"> | 39 | <a [href]="accountBlock.blockedAccount.url" i18n-title title="Open account in a new tab" target="_blank" rel="noopener noreferrer"> |
40 | <div class="chip two-lines"> | 40 | <div class="chip two-lines"> |
41 | <img | 41 | <my-account-avatar [account]="accountBlock.blockedAccount"></my-account-avatar> |
42 | class="avatar" | ||
43 | [src]="accountBlock.blockedAccount.avatar?.path" | ||
44 | (error)="switchToDefaultAvatar($event)" | ||
45 | alt="Avatar" | ||
46 | > | ||
47 | <div> | 42 | <div> |
48 | {{ accountBlock.blockedAccount.displayName }} | 43 | {{ accountBlock.blockedAccount.displayName }} |
49 | <span class="text-muted">{{ accountBlock.blockedAccount.nameWithHost }}</span> | 44 | <span class="text-muted">{{ accountBlock.blockedAccount.nameWithHost }}</span> |
diff --git a/client/src/app/shared/shared-moderation/account-blocklist.component.ts b/client/src/app/shared/shared-moderation/account-blocklist.component.ts index 3de9587b8..1bce65bf0 100644 --- a/client/src/app/shared/shared-moderation/account-blocklist.component.ts +++ b/client/src/app/shared/shared-moderation/account-blocklist.component.ts | |||
@@ -30,10 +30,6 @@ export class GenericAccountBlocklistComponent extends RestTable implements OnIni | |||
30 | this.initialize() | 30 | this.initialize() |
31 | } | 31 | } |
32 | 32 | ||
33 | switchToDefaultAvatar ($event: Event) { | ||
34 | ($event.target as HTMLImageElement).src = Account.GET_DEFAULT_AVATAR_URL() | ||
35 | } | ||
36 | |||
37 | unblockAccount (accountBlock: AccountBlock) { | 33 | unblockAccount (accountBlock: AccountBlock) { |
38 | const blockedAccount = accountBlock.blockedAccount | 34 | const blockedAccount = accountBlock.blockedAccount |
39 | const operation = this.mode === BlocklistComponentType.Account | 35 | const operation = this.mode === BlocklistComponentType.Account |
diff --git a/client/src/app/shared/shared-moderation/shared-moderation.module.ts b/client/src/app/shared/shared-moderation/shared-moderation.module.ts index b1b98f8d0..c7e201792 100644 --- a/client/src/app/shared/shared-moderation/shared-moderation.module.ts +++ b/client/src/app/shared/shared-moderation/shared-moderation.module.ts | |||
@@ -13,13 +13,15 @@ import { UserBanModalComponent } from './user-ban-modal.component' | |||
13 | import { UserModerationDropdownComponent } from './user-moderation-dropdown.component' | 13 | import { UserModerationDropdownComponent } from './user-moderation-dropdown.component' |
14 | import { VideoBlockComponent } from './video-block.component' | 14 | import { VideoBlockComponent } from './video-block.component' |
15 | import { VideoBlockService } from './video-block.service' | 15 | import { VideoBlockService } from './video-block.service' |
16 | import { SharedAccountAvatarModule } from '../shared-account-avatar/shared-account-avatar.module' | ||
16 | 17 | ||
17 | @NgModule({ | 18 | @NgModule({ |
18 | imports: [ | 19 | imports: [ |
19 | SharedMainModule, | 20 | SharedMainModule, |
20 | SharedFormModule, | 21 | SharedFormModule, |
21 | SharedGlobalIconModule, | 22 | SharedGlobalIconModule, |
22 | SharedVideoCommentModule | 23 | SharedVideoCommentModule, |
24 | SharedAccountAvatarModule | ||
23 | ], | 25 | ], |
24 | 26 | ||
25 | declarations: [ | 27 | declarations: [ |
diff --git a/client/src/app/shared/shared-video-comment/video-comment.model.ts b/client/src/app/shared/shared-video-comment/video-comment.model.ts index bf718ae08..9a4e3954e 100644 --- a/client/src/app/shared/shared-video-comment/video-comment.model.ts +++ b/client/src/app/shared/shared-video-comment/video-comment.model.ts | |||
@@ -17,7 +17,6 @@ export class VideoComment implements VideoCommentServerModel { | |||
17 | totalRepliesFromVideoAuthor: number | 17 | totalRepliesFromVideoAuthor: number |
18 | totalReplies: number | 18 | totalReplies: number |
19 | by: string | 19 | by: string |
20 | accountAvatarUrl: string | ||
21 | 20 | ||
22 | isLocal: boolean | 21 | isLocal: boolean |
23 | 22 | ||
@@ -38,7 +37,6 @@ export class VideoComment implements VideoCommentServerModel { | |||
38 | 37 | ||
39 | if (this.account) { | 38 | if (this.account) { |
40 | this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host) | 39 | this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host) |
41 | this.accountAvatarUrl = Account.GET_ACTOR_AVATAR_URL(this.account) | ||
42 | 40 | ||
43 | const absoluteAPIUrl = getAbsoluteAPIUrl() | 41 | const absoluteAPIUrl = getAbsoluteAPIUrl() |
44 | const thisHost = new URL(absoluteAPIUrl).host | 42 | const thisHost = new URL(absoluteAPIUrl).host |
@@ -70,7 +68,6 @@ export class VideoCommentAdmin implements VideoCommentAdminServerModel { | |||
70 | } | 68 | } |
71 | 69 | ||
72 | by: string | 70 | by: string |
73 | accountAvatarUrl: string | ||
74 | 71 | ||
75 | constructor (hash: VideoCommentAdminServerModel, textHtml: string) { | 72 | constructor (hash: VideoCommentAdminServerModel, textHtml: string) { |
76 | this.id = hash.id | 73 | this.id = hash.id |
@@ -97,7 +94,6 @@ export class VideoCommentAdmin implements VideoCommentAdminServerModel { | |||
97 | 94 | ||
98 | if (this.account) { | 95 | if (this.account) { |
99 | this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host) | 96 | this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host) |
100 | this.accountAvatarUrl = Account.GET_ACTOR_AVATAR_URL(this.account) | ||
101 | 97 | ||
102 | this.account.localUrl = '/accounts/' + this.by | 98 | this.account.localUrl = '/accounts/' + this.by |
103 | } | 99 | } |
diff --git a/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts b/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts index 7a7868853..32cfdfd68 100644 --- a/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts +++ b/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts | |||
@@ -13,6 +13,7 @@ import { VideoDownloadComponent } from './video-download.component' | |||
13 | import { VideoMiniatureComponent } from './video-miniature.component' | 13 | import { VideoMiniatureComponent } from './video-miniature.component' |
14 | import { VideosSelectionComponent } from './videos-selection.component' | 14 | import { VideosSelectionComponent } from './videos-selection.component' |
15 | import { VideoListHeaderComponent } from './video-list-header.component' | 15 | import { VideoListHeaderComponent } from './video-list-header.component' |
16 | import { SharedAccountAvatarModule } from '../shared-account-avatar/shared-account-avatar.module' | ||
16 | 17 | ||
17 | @NgModule({ | 18 | @NgModule({ |
18 | imports: [ | 19 | imports: [ |
@@ -23,7 +24,8 @@ import { VideoListHeaderComponent } from './video-list-header.component' | |||
23 | SharedThumbnailModule, | 24 | SharedThumbnailModule, |
24 | SharedGlobalIconModule, | 25 | SharedGlobalIconModule, |
25 | SharedVideoLiveModule, | 26 | SharedVideoLiveModule, |
26 | SharedVideoModule | 27 | SharedVideoModule, |
28 | SharedAccountAvatarModule | ||
27 | ], | 29 | ], |
28 | 30 | ||
29 | declarations: [ | 31 | declarations: [ |
diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.html b/client/src/app/shared/shared-video-miniature/video-miniature.component.html index bac8bcc2d..4e61c27b3 100644 --- a/client/src/app/shared/shared-video-miniature/video-miniature.component.html +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.html | |||
@@ -10,9 +10,10 @@ | |||
10 | <div class="video-bottom"> | 10 | <div class="video-bottom"> |
11 | <div class="video-miniature-information"> | 11 | <div class="video-miniature-information"> |
12 | <div class="d-flex video-miniature-meta"> | 12 | <div class="d-flex video-miniature-meta"> |
13 | <a *ngIf="displayOptions.avatar" class="avatar" [routerLink]="[ '/video-channels', video.byVideoChannel ]" [title]="channelLinkTitle"> | 13 | <a *ngIf="displayOptions.avatar && displayOwnerVideoChannel()" class="avatar" [routerLink]="[ '/video-channels', video.byVideoChannel ]" [title]="channelLinkTitle"> |
14 | <img [src]="getAvatarUrl()" alt="" [ngClass]="{ channel: displayOwnerVideoChannel() }" /> | 14 | <img [src]="getAvatarUrl()" alt="" class="channel" /> |
15 | </a> | 15 | </a> |
16 | <my-account-avatar *ngIf="displayOptions.avatar && displayOwnerAccount()" [account]="video.account" size="40" [href]="'/video-channels/' + video.byVideoChannel" [title]="channelLinkTitle"></my-account-avatar> | ||
16 | 17 | ||
17 | <div class="w-100 d-flex flex-column"> | 18 | <div class="w-100 d-flex flex-column"> |
18 | <a *ngIf="!videoHref" tabindex="-1" class="video-miniature-name" | 19 | <a *ngIf="!videoHref" tabindex="-1" class="video-miniature-name" |
diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.scss b/client/src/app/shared/shared-video-miniature/video-miniature.component.scss index 621951919..bf52b870c 100644 --- a/client/src/app/shared/shared-video-miniature/video-miniature.component.scss +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.scss | |||
@@ -12,13 +12,10 @@ $more-button-width: 40px; | |||
12 | width: calc(100% - #{$more-button-width}); | 12 | width: calc(100% - #{$more-button-width}); |
13 | } | 13 | } |
14 | 14 | ||
15 | my-account-avatar, | ||
15 | .avatar { | 16 | .avatar { |
16 | margin: 10px 10px 0 0; | 17 | margin: 10px 10px 0 0; |
17 | 18 | ||
18 | img:not(.channel) { | ||
19 | @include avatar(40px); | ||
20 | } | ||
21 | |||
22 | img.channel { | 19 | img.channel { |
23 | @include channel-avatar(40px); | 20 | @include channel-avatar(40px); |
24 | } | 21 | } |
diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts index 48da92d6b..8d66aaee2 100644 --- a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts | |||
@@ -182,7 +182,7 @@ export class VideoMiniatureComponent implements OnInit { | |||
182 | 182 | ||
183 | getAvatarUrl () { | 183 | getAvatarUrl () { |
184 | if (this.displayOwnerAccount()) { | 184 | if (this.displayOwnerAccount()) { |
185 | return this.video.accountAvatarUrl | 185 | return this.video.account.avatar?.url |
186 | } | 186 | } |
187 | 187 | ||
188 | return this.video.videoChannelAvatarUrl | 188 | return this.video.videoChannelAvatarUrl |