aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-moderation/video-report.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-moderation/video-report.component.ts')
-rw-r--r--client/src/app/shared/shared-moderation/video-report.component.ts29
1 files changed, 16 insertions, 13 deletions
diff --git a/client/src/app/shared/shared-moderation/video-report.component.ts b/client/src/app/shared/shared-moderation/video-report.component.ts
index 11c805636..b8d9f8d27 100644
--- a/client/src/app/shared/shared-moderation/video-report.component.ts
+++ b/client/src/app/shared/shared-moderation/video-report.component.ts
@@ -3,13 +3,13 @@ import { buildVideoEmbed, buildVideoLink } from 'src/assets/player/utils'
3import { Component, Input, OnInit, ViewChild } from '@angular/core' 3import { Component, Input, OnInit, ViewChild } from '@angular/core'
4import { DomSanitizer, SafeHtml } from '@angular/platform-browser' 4import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
5import { Notifier } from '@app/core' 5import { Notifier } from '@app/core'
6import { FormReactive, FormValidatorService, VideoAbuseValidatorsService } from '@app/shared/shared-forms' 6import { AbuseValidatorsService, FormReactive, FormValidatorService } from '@app/shared/shared-forms'
7import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 7import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
8import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' 8import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
9import { I18n } from '@ngx-translate/i18n-polyfill' 9import { I18n } from '@ngx-translate/i18n-polyfill'
10import { videoAbusePredefinedReasonsMap, VideoAbusePredefinedReasonsString } from '@shared/models/videos/abuse/video-abuse-reason.model' 10import { abusePredefinedReasonsMap, AbusePredefinedReasonsString } from '@shared/models'
11import { Video } from '../shared-main' 11import { Video } from '../shared-main'
12import { VideoAbuseService } from './video-abuse.service' 12import { AbuseService } from './abuse.service'
13 13
14@Component({ 14@Component({
15 selector: 'my-video-report', 15 selector: 'my-video-report',
@@ -22,7 +22,7 @@ export class VideoReportComponent extends FormReactive implements OnInit {
22 @ViewChild('modal', { static: true }) modal: NgbModal 22 @ViewChild('modal', { static: true }) modal: NgbModal
23 23
24 error: string = null 24 error: string = null
25 predefinedReasons: { id: VideoAbusePredefinedReasonsString, label: string, description?: string, help?: string }[] = [] 25 predefinedReasons: { id: AbusePredefinedReasonsString, label: string, description?: string, help?: string }[] = []
26 embedHtml: SafeHtml 26 embedHtml: SafeHtml
27 27
28 private openedModal: NgbModalRef 28 private openedModal: NgbModalRef
@@ -30,8 +30,8 @@ export class VideoReportComponent extends FormReactive implements OnInit {
30 constructor ( 30 constructor (
31 protected formValidatorService: FormValidatorService, 31 protected formValidatorService: FormValidatorService,
32 private modalService: NgbModal, 32 private modalService: NgbModal,
33 private videoAbuseValidatorsService: VideoAbuseValidatorsService, 33 private abuseValidatorsService: AbuseValidatorsService,
34 private videoAbuseService: VideoAbuseService, 34 private abuseService: AbuseService,
35 private notifier: Notifier, 35 private notifier: Notifier,
36 private sanitizer: DomSanitizer, 36 private sanitizer: DomSanitizer,
37 private i18n: I18n 37 private i18n: I18n
@@ -69,8 +69,8 @@ export class VideoReportComponent extends FormReactive implements OnInit {
69 69
70 ngOnInit () { 70 ngOnInit () {
71 this.buildForm({ 71 this.buildForm({
72 reason: this.videoAbuseValidatorsService.VIDEO_ABUSE_REASON, 72 reason: this.abuseValidatorsService.ABUSE_REASON,
73 predefinedReasons: mapValues(videoAbusePredefinedReasonsMap, r => null), 73 predefinedReasons: mapValues(abusePredefinedReasonsMap, r => null),
74 timestamp: { 74 timestamp: {
75 hasStart: null, 75 hasStart: null,
76 startAt: null, 76 startAt: null,
@@ -136,15 +136,18 @@ export class VideoReportComponent extends FormReactive implements OnInit {
136 136
137 report () { 137 report () {
138 const reason = this.form.get('reason').value 138 const reason = this.form.get('reason').value
139 const predefinedReasons = Object.keys(pickBy(this.form.get('predefinedReasons').value)) as VideoAbusePredefinedReasonsString[] 139 const predefinedReasons = Object.keys(pickBy(this.form.get('predefinedReasons').value)) as AbusePredefinedReasonsString[]
140 const { hasStart, startAt, hasEnd, endAt } = this.form.get('timestamp').value 140 const { hasStart, startAt, hasEnd, endAt } = this.form.get('timestamp').value
141 141
142 this.videoAbuseService.reportVideo({ 142 this.abuseService.reportVideo({
143 id: this.video.id, 143 accountId: this.video.account.id,
144 reason, 144 reason,
145 predefinedReasons, 145 predefinedReasons,
146 startAt: hasStart && startAt ? startAt : undefined, 146 video: {
147 endAt: hasEnd && endAt ? endAt : undefined 147 id: this.video.id,
148 startAt: hasStart && startAt ? startAt : undefined,
149 endAt: hasEnd && endAt ? endAt : undefined
150 }
148 }).subscribe( 151 }).subscribe(
149 () => { 152 () => {
150 this.notifier.success(this.i18n('Video reported.')) 153 this.notifier.success(this.i18n('Video reported.'))