blob: 5db2887fa8bd7ef48ee83d5400f8e900d8922fbf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
import { Component, Input } from '@angular/core'
import { Actor } from '@app/shared/shared-main'
import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoAbusePredefinedReasonsString } from '../../../../../../shared/models/videos/abuse/video-abuse-reason.model'
import { ProcessedVideoAbuse } from './video-abuse-list.component'
import { durationToString } from '@app/helpers'
@Component({
selector: 'my-video-abuse-details',
templateUrl: './video-abuse-details.component.html',
styleUrls: [ '../moderation.component.scss' ]
})
export class VideoAbuseDetailsComponent {
@Input() videoAbuse: ProcessedVideoAbuse
private predefinedReasonsTranslations: { [key in VideoAbusePredefinedReasonsString]: string }
constructor (
private i18n: I18n
) {
this.predefinedReasonsTranslations = {
violentOrRepulsive: this.i18n('Violent or Repulsive'),
hatefulOrAbusive: this.i18n('Hateful or Abusive'),
spamOrMisleading: this.i18n('Spam or Misleading'),
privacy: this.i18n('Privacy'),
rights: this.i18n('Rights'),
serverRules: this.i18n('Server rules'),
thumbnails: this.i18n('Thumbnails'),
captions: this.i18n('Captions')
}
}
get startAt () {
return durationToString(this.videoAbuse.startAt)
}
get endAt () {
return durationToString(this.videoAbuse.endAt)
}
getPredefinedReasons () {
if (!this.videoAbuse.predefinedReasons) return []
return this.videoAbuse.predefinedReasons.map(r => ({
id: r,
label: this.predefinedReasonsTranslations[r]
}))
}
switchToDefaultAvatar ($event: Event) {
($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL()
}
}
|