]>
Commit | Line | Data |
---|---|---|
1 | import { Component, Input } from '@angular/core' | |
2 | import { durationToString } from '@app/helpers' | |
3 | import { AbusePredefinedReasonsString } from '@shared/models' | |
4 | import { ProcessedAbuse } from './processed-abuse.model' | |
5 | ||
6 | @Component({ | |
7 | selector: 'my-abuse-details', | |
8 | templateUrl: './abuse-details.component.html', | |
9 | styleUrls: [ '../shared-moderation/moderation.scss', './abuse-details.component.scss' ] | |
10 | }) | |
11 | export class AbuseDetailsComponent { | |
12 | @Input() abuse: ProcessedAbuse | |
13 | @Input() isAdminView: boolean | |
14 | ||
15 | private predefinedReasonsTranslations: { [key in AbusePredefinedReasonsString]: string } | |
16 | ||
17 | constructor () { | |
18 | this.predefinedReasonsTranslations = { | |
19 | violentOrRepulsive: $localize`Violent or Repulsive`, | |
20 | hatefulOrAbusive: $localize`Hateful or Abusive`, | |
21 | spamOrMisleading: $localize`Spam or Misleading`, | |
22 | privacy: $localize`Privacy`, | |
23 | rights: $localize`Copyright`, | |
24 | serverRules: $localize`Server rules`, | |
25 | thumbnails: $localize`Thumbnails`, | |
26 | captions: $localize`Captions` | |
27 | } | |
28 | } | |
29 | ||
30 | get startAt () { | |
31 | return durationToString(this.abuse.video.startAt) | |
32 | } | |
33 | ||
34 | get endAt () { | |
35 | return durationToString(this.abuse.video.endAt) | |
36 | } | |
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 | } |