1 import { Component, Input } from '@angular/core'
2 import { Actor } from '@app/shared/shared-main'
3 import { I18n } from '@ngx-translate/i18n-polyfill'
4 import { AbusePredefinedReasonsString } from '@shared/models'
5 import { ProcessedAbuse } from './abuse-list.component'
6 import { durationToString } from '@app/helpers'
9 selector: 'my-abuse-details',
10 templateUrl: './abuse-details.component.html',
11 styleUrls: [ '../moderation.component.scss' ]
13 export class AbuseDetailsComponent {
14 @Input() abuse: ProcessedAbuse
16 private predefinedReasonsTranslations: { [key in AbusePredefinedReasonsString]: string }
21 this.predefinedReasonsTranslations = {
22 violentOrRepulsive: this.i18n('Violent or Repulsive'),
23 hatefulOrAbusive: this.i18n('Hateful or Abusive'),
24 spamOrMisleading: this.i18n('Spam or Misleading'),
25 privacy: this.i18n('Privacy'),
26 rights: this.i18n('Rights'),
27 serverRules: this.i18n('Server rules'),
28 thumbnails: this.i18n('Thumbnails'),
29 captions: this.i18n('Captions')
34 return durationToString(this.abuse.video.startAt)
38 return durationToString(this.abuse.video.endAt)
41 getPredefinedReasons () {
42 if (!this.abuse.predefinedReasons) return []
44 return this.abuse.predefinedReasons.map(r => ({
46 label: this.predefinedReasonsTranslations[r]
50 switchToDefaultAvatar ($event: Event) {
51 ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL()