]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts
Refactor video links building
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-moderation / report-modals / comment-report.component.ts
index 00d7b8d342f40c81c554e474cce758142bc1f08e..c7395c7b756ebde9674cea83971708b7c36e65ed 100644 (file)
@@ -1,12 +1,13 @@
 import { mapValues, pickBy } from 'lodash-es'
 import { Component, Input, OnInit, ViewChild } from '@angular/core'
 import { Notifier } from '@app/core'
-import { AbuseValidatorsService, FormReactive, FormValidatorService } from '@app/shared/shared-forms'
+import { ABUSE_REASON_VALIDATOR } from '@app/shared/form-validators/abuse-validators'
+import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
 import { VideoComment } from '@app/shared/shared-video-comment'
 import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
 import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { abusePredefinedReasonsMap, AbusePredefinedReasonsString } from '@shared/models'
+import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
+import { AbusePredefinedReasonsString } from '@shared/models'
 import { AbuseService } from '../abuse.service'
 
 @Component({
@@ -28,10 +29,8 @@ export class CommentReportComponent extends FormReactive implements OnInit {
   constructor (
     protected formValidatorService: FormValidatorService,
     private modalService: NgbModal,
-    private abuseValidatorsService: AbuseValidatorsService,
     private abuseService: AbuseService,
-    private notifier: Notifier,
-    private i18n: I18n
+    private notifier: Notifier
   ) {
     super()
   }
@@ -49,10 +48,10 @@ export class CommentReportComponent extends FormReactive implements OnInit {
   }
 
   ngOnInit () {
-    this.modalTitle = this.i18n('Report comment')
+    this.modalTitle = $localize`Report comment`
 
     this.buildForm({
-      reason: this.abuseValidatorsService.ABUSE_REASON,
+      reason: ABUSE_REASON_VALIDATOR,
       predefinedReasons: mapValues(abusePredefinedReasonsMap, r => null)
     })
 
@@ -80,7 +79,7 @@ export class CommentReportComponent extends FormReactive implements OnInit {
       }
     }).subscribe(
       () => {
-        this.notifier.success(this.i18n('Comment reported.'))
+        this.notifier.success($localize`Comment reported.`)
         this.hide()
       },