aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/shared-abuse-list/abuse-details.component.html7
-rw-r--r--client/src/app/shared/shared-abuse-list/abuse-details.component.ts23
2 files changed, 15 insertions, 15 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 fdf700f7c..089be501d 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
@@ -60,10 +60,9 @@
60 <span class="moderation-expanded-text" [innerHTML]="abuse.reasonHtml"></span> 60 <span class="moderation-expanded-text" [innerHTML]="abuse.reasonHtml"></span>
61 </div> 61 </div>
62 62
63 <div *ngIf="getPredefinedReasons()" class="mt-2 d-flex"> 63 <div *ngIf="predefinedReasons" class="mt-2 d-flex">
64 <span class="></span> 64 <span>
65 <span class="> 65 <a *ngFor="let reason of predefinedReasons" [routerLink]="[ '.' ]"
66 <a *ngFor="let reason of getPredefinedReasons()" [routerLink]="[ '.' ]"
67 [queryParams]="{ 'search': 'tag:' + reason.id }" class="chip rectangular bg-secondary text-light" 66 [queryParams]="{ 'search': 'tag:' + reason.id }" class="chip rectangular bg-secondary text-light"
68 > 67 >
69 <div>{{ reason.label }}</div> 68 <div>{{ reason.label }}</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 14674c5f0..e15edf8c2 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
@@ -1,4 +1,4 @@
1import { Component, Input } from '@angular/core' 1import { Component, Input, OnInit } from '@angular/core'
2import { durationToString } from '@app/helpers' 2import { durationToString } from '@app/helpers'
3import { AbusePredefinedReasonsString } from '@shared/models' 3import { AbusePredefinedReasonsString } from '@shared/models'
4import { ProcessedAbuse } from './processed-abuse.model' 4import { ProcessedAbuse } from './processed-abuse.model'
@@ -8,10 +8,11 @@ import { ProcessedAbuse } from './processed-abuse.model'
8 templateUrl: './abuse-details.component.html', 8 templateUrl: './abuse-details.component.html',
9 styleUrls: [ '../shared-moderation/moderation.scss', './abuse-details.component.scss' ] 9 styleUrls: [ '../shared-moderation/moderation.scss', './abuse-details.component.scss' ]
10}) 10})
11export class AbuseDetailsComponent { 11export class AbuseDetailsComponent implements OnInit {
12 @Input() abuse: ProcessedAbuse 12 @Input() abuse: ProcessedAbuse
13 @Input() isAdminView: boolean 13 @Input() isAdminView: boolean
14 14
15 predefinedReasons: { id: string, label: string }[]
15 private predefinedReasonsTranslations: { [key in AbusePredefinedReasonsString]: string } 16 private predefinedReasonsTranslations: { [key in AbusePredefinedReasonsString]: string }
16 17
17 constructor () { 18 constructor () {
@@ -27,6 +28,15 @@ export class AbuseDetailsComponent {
27 } 28 }
28 } 29 }
29 30
31 ngOnInit (): void {
32 if (!this.abuse.predefinedReasons) return
33
34 this.predefinedReasons = this.abuse.predefinedReasons.map(r => ({
35 id: r,
36 label: this.predefinedReasonsTranslations[r]
37 }))
38 }
39
30 get startAt () { 40 get startAt () {
31 return durationToString(this.abuse.video.startAt) 41 return durationToString(this.abuse.video.startAt)
32 } 42 }
@@ -34,13 +44,4 @@ export class AbuseDetailsComponent {
34 get endAt () { 44 get endAt () {
35 return durationToString(this.abuse.video.endAt) 45 return durationToString(this.abuse.video.endAt)
36 } 46 }
37
38 getPredefinedReasons () {
39 if (!this.abuse.predefinedReasons) return []
40
41 return this.abuse.predefinedReasons.map(r => ({
42 id: r,
43 label: this.predefinedReasonsTranslations[r]
44 }))
45 }
46} 47}