aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/modal/video-report.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/videos/+video-watch/modal/video-report.component.ts')
-rw-r--r--client/src/app/videos/+video-watch/modal/video-report.component.ts80
1 files changed, 0 insertions, 80 deletions
diff --git a/client/src/app/videos/+video-watch/modal/video-report.component.ts b/client/src/app/videos/+video-watch/modal/video-report.component.ts
deleted file mode 100644
index 911f3b447..000000000
--- a/client/src/app/videos/+video-watch/modal/video-report.component.ts
+++ /dev/null
@@ -1,80 +0,0 @@
1import { Component, Input, OnInit, ViewChild } from '@angular/core'
2import { Notifier } from '@app/core'
3import { FormReactive, VideoAbuseService } from '../../../shared/index'
4import { VideoDetails } from '../../../shared/video/video-details.model'
5import { I18n } from '@ngx-translate/i18n-polyfill'
6import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
7import { VideoAbuseValidatorsService } from '@app/shared/forms/form-validators/video-abuse-validators.service'
8import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
9import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
10
11@Component({
12 selector: 'my-video-report',
13 templateUrl: './video-report.component.html',
14 styleUrls: [ './video-report.component.scss' ]
15})
16export class VideoReportComponent extends FormReactive implements OnInit {
17 @Input() video: VideoDetails = null
18
19 @ViewChild('modal') modal: NgbModal
20
21 error: string = null
22
23 private openedModal: NgbModalRef
24
25 constructor (
26 protected formValidatorService: FormValidatorService,
27 private modalService: NgbModal,
28 private videoAbuseValidatorsService: VideoAbuseValidatorsService,
29 private videoAbuseService: VideoAbuseService,
30 private notifier: Notifier,
31 private i18n: I18n
32 ) {
33 super()
34 }
35
36 get currentHost () {
37 return window.location.host
38 }
39
40 get originHost () {
41 if (this.isRemoteVideo()) {
42 return this.video.account.host
43 }
44
45 return ''
46 }
47
48 ngOnInit () {
49 this.buildForm({
50 reason: this.videoAbuseValidatorsService.VIDEO_ABUSE_REASON
51 })
52 }
53
54 show () {
55 this.openedModal = this.modalService.open(this.modal, { keyboard: false })
56 }
57
58 hide () {
59 this.openedModal.close()
60 this.openedModal = null
61 }
62
63 report () {
64 const reason = this.form.value['reason']
65
66 this.videoAbuseService.reportVideo(this.video.id, reason)
67 .subscribe(
68 () => {
69 this.notifier.success(this.i18n('Video reported.'))
70 this.hide()
71 },
72
73 err => this.notifier.error(err.message)
74 )
75 }
76
77 isRemoteVideo () {
78 return !this.video.isLocal
79 }
80}