]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-abuse-list/abuse-details.component.ts
Merge branch 'release/5.0.0' into develop
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-abuse-list / abuse-details.component.ts
index e8ce7e678338a5c5182491cba0c4d5c6bf09ba11..e15edf8c24f5790134fdf4731f432e282715d79a 100644 (file)
@@ -1,6 +1,5 @@
-import { Component, Input } from '@angular/core'
+import { Component, Input, OnInit } from '@angular/core'
 import { durationToString } from '@app/helpers'
-import { Account } from '@app/shared/shared-main'
 import { AbusePredefinedReasonsString } from '@shared/models'
 import { ProcessedAbuse } from './processed-abuse.model'
 
@@ -9,11 +8,11 @@ import { ProcessedAbuse } from './processed-abuse.model'
   templateUrl: './abuse-details.component.html',
   styleUrls: [ '../shared-moderation/moderation.scss', './abuse-details.component.scss' ]
 })
-export class AbuseDetailsComponent {
+export class AbuseDetailsComponent implements OnInit {
   @Input() abuse: ProcessedAbuse
   @Input() isAdminView: boolean
-  @Input() baseRoute: string
 
+  predefinedReasons: { id: string, label: string }[]
   private predefinedReasonsTranslations: { [key in AbusePredefinedReasonsString]: string }
 
   constructor () {
@@ -29,6 +28,15 @@ export class AbuseDetailsComponent {
     }
   }
 
+  ngOnInit (): void {
+    if (!this.abuse.predefinedReasons) return
+
+    this.predefinedReasons = this.abuse.predefinedReasons.map(r => ({
+      id: r,
+      label: this.predefinedReasonsTranslations[r]
+    }))
+  }
+
   get startAt () {
     return durationToString(this.abuse.video.startAt)
   }
@@ -36,13 +44,4 @@ export class AbuseDetailsComponent {
   get endAt () {
     return durationToString(this.abuse.video.endAt)
   }
-
-  getPredefinedReasons () {
-    if (!this.abuse.predefinedReasons) return []
-
-    return this.abuse.predefinedReasons.map(r => ({
-      id: r,
-      label: this.predefinedReasonsTranslations[r]
-    }))
-  }
 }