import { mapValues, pickBy } from 'lodash-es'
-import { buildVideoEmbed, buildVideoLink } from 'src/assets/player/utils'
+import { 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 { decorateVideoLink } from '@shared/core-utils'
import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
import { AbusePredefinedReasonsString } from '@shared/models'
import { Video } from '../../shared-main'
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()
}
getVideoEmbed () {
return this.sanitizer.bypassSecurityTrustHtml(
- buildVideoEmbed(
- buildVideoLink({
- baseUrl: this.video.embedUrl,
+ buildVideoOrPlaylistEmbed(
+ decorateVideoLink({
+ url: 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,
}
}).subscribe(
() => {
- this.notifier.success(this.i18n('Video reported.'))
+ this.notifier.success($localize`Video reported.`)
this.hide()
},