X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fvideos%2Fvideo-watch%2Fvideo-report.component.ts;h=61213cd684dab17ab40123c1619f513741e636ec;hb=33c4972d5b54155540267f4c9c9ee55c539b8385;hp=19a7af1482c3c3ff9f429450004c36c13bf7b756;hpb=7ddd02c9b8c1e088f6679a2227f105e6439fc992;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/videos/video-watch/video-report.component.ts b/client/src/app/videos/video-watch/video-report.component.ts index 19a7af148..61213cd68 100644 --- a/client/src/app/videos/video-watch/video-report.component.ts +++ b/client/src/app/videos/video-watch/video-report.component.ts @@ -1,69 +1,69 @@ -import { Component, Input, OnInit, ViewChild } from '@angular/core'; -import { FormBuilder, FormGroup } from '@angular/forms'; +import { Component, Input, OnInit, ViewChild } from '@angular/core' +import { FormBuilder, FormGroup } from '@angular/forms' -import { ModalDirective } from 'ng2-bootstrap/modal'; -import { NotificationsService } from 'angular2-notifications'; +import { ModalDirective } from 'ngx-bootstrap/modal' +import { NotificationsService } from 'angular2-notifications' -import { FormReactive, VideoAbuseService, VIDEO_ABUSE_REASON } from '../../shared'; -import { Video, VideoService } from '../shared'; +import { FormReactive, VideoAbuseService, VIDEO_ABUSE_REASON } from '../../shared' +import { Video, VideoService } from '../shared' @Component({ selector: 'my-video-report', templateUrl: './video-report.component.html' }) export class VideoReportComponent extends FormReactive implements OnInit { - @Input() video: Video = null; + @Input() video: Video = null - @ViewChild('modal') modal: ModalDirective; + @ViewChild('modal') modal: ModalDirective - error: string = null; - form: FormGroup; + error: string = null + form: FormGroup formErrors = { reason: '' - }; + } validationMessages = { reason: VIDEO_ABUSE_REASON.MESSAGES - }; + } - constructor( + constructor ( private formBuilder: FormBuilder, private videoAbuseService: VideoAbuseService, private notificationsService: NotificationsService ) { - super(); + super() } - ngOnInit() { - this.buildForm(); + ngOnInit () { + this.buildForm() } - buildForm() { + buildForm () { this.form = this.formBuilder.group({ reason: [ '', VIDEO_ABUSE_REASON.VALIDATORS ] - }); + }) - this.form.valueChanges.subscribe(data => this.onValueChanged(data)); + this.form.valueChanges.subscribe(data => this.onValueChanged(data)) } - show() { - this.modal.show(); + show () { + this.modal.show() } - hide() { - this.modal.hide(); + hide () { + this.modal.hide() } - report() { + report () { const reason = this.form.value['reason'] this.videoAbuseService.reportVideo(this.video.id, reason) - .subscribe( - () => { - this.notificationsService.success('Success', 'Video reported.'); - this.hide(); - }, + .subscribe( + () => { + this.notificationsService.success('Success', 'Video reported.') + this.hide() + }, - err => this.notificationsService.error('Error', err.text); - ) + err => this.notificationsService.error('Error', err.text) + ) } }