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/shared-abuse-list | |
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/shared-abuse-list')
5 files changed, 6 insertions, 27 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: [ |