]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/shared-abuse-list/abuse-details.component.ts
Bumped to version v5.2.1
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-abuse-list / abuse-details.component.ts
1 import { Component, Input, OnInit } 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 implements OnInit {
12 @Input() abuse: ProcessedAbuse
13 @Input() isAdminView: boolean
14
15 predefinedReasons: { id: string, label: string }[]
16 private predefinedReasonsTranslations: { [key in AbusePredefinedReasonsString]: string }
17
18 constructor () {
19 this.predefinedReasonsTranslations = {
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`
28 }
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
40 get startAt () {
41 return durationToString(this.abuse.video.startAt)
42 }
43
44 get endAt () {
45 return durationToString(this.abuse.video.endAt)
46 }
47 }