X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Badmin%2Fmoderation%2Fvideo-abuse-list%2Fvideo-abuse-details.component.ts;h=5db2887fa8bd7ef48ee83d5400f8e900d8922fbf;hb=72493e44e9b455a04c4f093ed6c6ffa300b98d8b;hp=d9cb19845f03a5440c0e466d9a872fdea7b734b6;hpb=25a42e293be90d35afad2096e9db2fa3d617d855;p=github%2FChocobozzz%2FPeerTube.git 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..5db2887fa 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 @@ import { Component, Input } from '@angular/core' -import { Account } from '@app/shared/account/account.model' -import { Actor } from '@app/shared/actor/actor.model' +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', @@ -11,6 +13,39 @@ import { ProcessedVideoAbuse } from './video-abuse-list.component' 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() }