]>
Commit | Line | Data |
---|---|---|
a28b0f69 | 1 | import { Component, Input, OnInit } from '@angular/core' |
94148c90 | 2 | import { durationToString } from '@app/helpers' |
d95d1559 | 3 | import { AbusePredefinedReasonsString } from '@shared/models' |
94148c90 | 4 | import { ProcessedAbuse } from './processed-abuse.model' |
801d9571 RK |
5 | |
6 | @Component({ | |
d95d1559 C |
7 | selector: 'my-abuse-details', |
8 | templateUrl: './abuse-details.component.html', | |
94148c90 | 9 | styleUrls: [ '../shared-moderation/moderation.scss', './abuse-details.component.scss' ] |
801d9571 | 10 | }) |
a28b0f69 | 11 | export class AbuseDetailsComponent implements OnInit { |
d95d1559 | 12 | @Input() abuse: ProcessedAbuse |
94148c90 | 13 | @Input() isAdminView: boolean |
801d9571 | 14 | |
a28b0f69 | 15 | predefinedReasons: { id: string, label: string }[] |
d95d1559 | 16 | private predefinedReasonsTranslations: { [key in AbusePredefinedReasonsString]: string } |
1ebddadd | 17 | |
66357162 | 18 | constructor () { |
1ebddadd | 19 | this.predefinedReasonsTranslations = { |
66357162 C |
20 | violentOrRepulsive: $localize`Violent or Repulsive`, |
21 | hatefulOrAbusive: $localize`Hateful or Abusive`, | |
22 | spamOrMisleading: $localize`Spam or Misleading`, | |
23 | privacy: $localize`Privacy`, | |
24 | rights: $localize`Copyright`, | |
25 | serverRules: $localize`Server rules`, | |
26 | thumbnails: $localize`Thumbnails`, | |
27 | captions: $localize`Captions` | |
1ebddadd RK |
28 | } |
29 | } | |
30 | ||
a28b0f69 | 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 | ||
1ebddadd | 40 | get startAt () { |
8ca56654 | 41 | return durationToString(this.abuse.video.startAt) |
1ebddadd RK |
42 | } |
43 | ||
44 | get endAt () { | |
8ca56654 | 45 | return durationToString(this.abuse.video.endAt) |
1ebddadd | 46 | } |
801d9571 | 47 | } |