diff options
Diffstat (limited to 'client/src/app/+admin/moderation/video-abuse-list/video-abuse-details.component.ts')
-rw-r--r-- | client/src/app/+admin/moderation/video-abuse-list/video-abuse-details.component.ts | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-details.component.ts b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-details.component.ts index d9cb19845..13485124f 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-details.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-details.component.ts | |||
@@ -1,7 +1,9 @@ | |||
1 | import { Component, Input } from '@angular/core' | 1 | import { Component, Input } from '@angular/core' |
2 | import { Account } from '@app/shared/account/account.model' | ||
3 | import { Actor } from '@app/shared/actor/actor.model' | 2 | import { Actor } from '@app/shared/actor/actor.model' |
3 | import { VideoAbusePredefinedReasonsString } from '../../../../../../shared/models/videos/abuse/video-abuse-reason.model' | ||
4 | import { ProcessedVideoAbuse } from './video-abuse-list.component' | 4 | import { ProcessedVideoAbuse } from './video-abuse-list.component' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | import { durationToString } from '@app/shared/misc/utils' | ||
5 | 7 | ||
6 | @Component({ | 8 | @Component({ |
7 | selector: 'my-video-abuse-details', | 9 | selector: 'my-video-abuse-details', |
@@ -11,6 +13,39 @@ import { ProcessedVideoAbuse } from './video-abuse-list.component' | |||
11 | export class VideoAbuseDetailsComponent { | 13 | export class VideoAbuseDetailsComponent { |
12 | @Input() videoAbuse: ProcessedVideoAbuse | 14 | @Input() videoAbuse: ProcessedVideoAbuse |
13 | 15 | ||
16 | private predefinedReasonsTranslations: { [key in VideoAbusePredefinedReasonsString]: string } | ||
17 | |||
18 | constructor ( | ||
19 | private i18n: I18n | ||
20 | ) { | ||
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') | ||
30 | } | ||
31 | } | ||
32 | |||
33 | get startAt () { | ||
34 | return durationToString(this.videoAbuse.startAt) | ||
35 | } | ||
36 | |||
37 | get endAt () { | ||
38 | return durationToString(this.videoAbuse.endAt) | ||
39 | } | ||
40 | |||
41 | getPredefinedReasons () { | ||
42 | if (!this.videoAbuse.predefinedReasons) return [] | ||
43 | return this.videoAbuse.predefinedReasons.map(r => ({ | ||
44 | id: r, | ||
45 | label: this.predefinedReasonsTranslations[r] | ||
46 | })) | ||
47 | } | ||
48 | |||
14 | switchToDefaultAvatar ($event: Event) { | 49 | switchToDefaultAvatar ($event: Event) { |
15 | ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL() | 50 | ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL() |
16 | } | 51 | } |