]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-moderation/report-modals/video-report.component.ts
fix missing title attribute on <iframe> tag suggested for embedding (#3901)
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-moderation / report-modals / video-report.component.ts
index 7d53ea3c9c97589f5656dd3c5a5ead39550fd373..4ca6f52ad499887872b7beb34f7dd98484580ba6 100644 (file)
@@ -1,13 +1,14 @@
 import { mapValues, pickBy } from 'lodash-es'
-import { buildVideoEmbed, buildVideoLink } from 'src/assets/player/utils'
+import { buildVideoLink, buildVideoOrPlaylistEmbed } from 'src/assets/player/utils'
 import { Component, Input, OnInit, ViewChild } from '@angular/core'
 import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
 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 { 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 { Video } from '../../shared-main'
 import { AbuseService } from '../abuse.service'
 
@@ -30,11 +31,9 @@ export class VideoReportComponent extends FormReactive implements OnInit {
   constructor (
     protected formValidatorService: FormValidatorService,
     private modalService: NgbModal,
-    private abuseValidatorsService: AbuseValidatorsService,
     private abuseService: AbuseService,
     private notifier: Notifier,
-    private sanitizer: DomSanitizer,
-    private i18n: I18n
+    private sanitizer: DomSanitizer
   ) {
     super()
   }
@@ -57,19 +56,20 @@ export class VideoReportComponent extends FormReactive implements OnInit {
 
   getVideoEmbed () {
     return this.sanitizer.bypassSecurityTrustHtml(
-      buildVideoEmbed(
+      buildVideoOrPlaylistEmbed(
         buildVideoLink({
           baseUrl: this.video.embedUrl,
           title: false,
           warningTitle: false
-        })
+        }),
+        this.video.name
       )
     )
   }
 
   ngOnInit () {
     this.buildForm({
-      reason: this.abuseValidatorsService.ABUSE_REASON,
+      reason: ABUSE_REASON_VALIDATOR,
       predefinedReasons: mapValues(abusePredefinedReasonsMap, r => null),
       timestamp: {
         hasStart: null,
@@ -108,7 +108,7 @@ export class VideoReportComponent extends FormReactive implements OnInit {
       }
     }).subscribe(
       () => {
-        this.notifier.success(this.i18n('Video reported.'))
+        this.notifier.success($localize`Video reported.`)
         this.hide()
       },