diff options
Diffstat (limited to 'client/src/app/videos/video-watch')
-rw-r--r-- | client/src/app/videos/video-watch/video-report.component.ts | 11 | ||||
-rw-r--r-- | client/src/app/videos/video-watch/video-watch.component.ts | 8 |
2 files changed, 11 insertions, 8 deletions
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 7a125f53e..19a7af148 100644 --- a/client/src/app/videos/video-watch/video-report.component.ts +++ b/client/src/app/videos/video-watch/video-report.component.ts | |||
@@ -2,6 +2,7 @@ import { Component, Input, OnInit, ViewChild } from '@angular/core'; | |||
2 | import { FormBuilder, FormGroup } from '@angular/forms'; | 2 | import { FormBuilder, FormGroup } from '@angular/forms'; |
3 | 3 | ||
4 | import { ModalDirective } from 'ng2-bootstrap/modal'; | 4 | import { ModalDirective } from 'ng2-bootstrap/modal'; |
5 | import { NotificationsService } from 'angular2-notifications'; | ||
5 | 6 | ||
6 | import { FormReactive, VideoAbuseService, VIDEO_ABUSE_REASON } from '../../shared'; | 7 | import { FormReactive, VideoAbuseService, VIDEO_ABUSE_REASON } from '../../shared'; |
7 | import { Video, VideoService } from '../shared'; | 8 | import { Video, VideoService } from '../shared'; |
@@ -26,7 +27,8 @@ export class VideoReportComponent extends FormReactive implements OnInit { | |||
26 | 27 | ||
27 | constructor( | 28 | constructor( |
28 | private formBuilder: FormBuilder, | 29 | private formBuilder: FormBuilder, |
29 | private videoAbuseService: VideoAbuseService | 30 | private videoAbuseService: VideoAbuseService, |
31 | private notificationsService: NotificationsService | ||
30 | ) { | 32 | ) { |
31 | super(); | 33 | super(); |
32 | } | 34 | } |
@@ -56,13 +58,12 @@ export class VideoReportComponent extends FormReactive implements OnInit { | |||
56 | 58 | ||
57 | this.videoAbuseService.reportVideo(this.video.id, reason) | 59 | this.videoAbuseService.reportVideo(this.video.id, reason) |
58 | .subscribe( | 60 | .subscribe( |
59 | // TODO: move alert to beautiful notifications | 61 | () => { |
60 | ok => { | 62 | this.notificationsService.success('Success', 'Video reported.'); |
61 | alert('Video reported.'); | ||
62 | this.hide(); | 63 | this.hide(); |
63 | }, | 64 | }, |
64 | 65 | ||
65 | err => alert(err.text) | 66 | err => this.notificationsService.error('Error', err.text); |
66 | ) | 67 | ) |
67 | } | 68 | } |
68 | } | 69 | } |
diff --git a/client/src/app/videos/video-watch/video-watch.component.ts b/client/src/app/videos/video-watch/video-watch.component.ts index 5cd7550be..c27133f74 100644 --- a/client/src/app/videos/video-watch/video-watch.component.ts +++ b/client/src/app/videos/video-watch/video-watch.component.ts | |||
@@ -1,8 +1,9 @@ | |||
1 | import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'; | 1 | import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'; |
2 | import { ActivatedRoute } from '@angular/router'; | 2 | import { ActivatedRoute } from '@angular/router'; |
3 | 3 | ||
4 | import { MetaService } from 'ng2-meta'; | ||
5 | import * as videojs from 'video.js'; | 4 | import * as videojs from 'video.js'; |
5 | import { MetaService } from 'ng2-meta'; | ||
6 | import { NotificationsService } from 'angular2-notifications'; | ||
6 | 7 | ||
7 | import { AuthService } from '../../core'; | 8 | import { AuthService } from '../../core'; |
8 | import { VideoMagnetComponent } from './video-magnet.component'; | 9 | import { VideoMagnetComponent } from './video-magnet.component'; |
@@ -45,7 +46,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
45 | private videoService: VideoService, | 46 | private videoService: VideoService, |
46 | private metaService: MetaService, | 47 | private metaService: MetaService, |
47 | private webTorrentService: WebTorrentService, | 48 | private webTorrentService: WebTorrentService, |
48 | private authService: AuthService | 49 | private authService: AuthService, |
50 | private notificationsService: NotificationsService | ||
49 | ) {} | 51 | ) {} |
50 | 52 | ||
51 | ngOnInit() { | 53 | ngOnInit() { |
@@ -117,7 +119,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
117 | console.log('Added ' + this.video.magnetUri + '.'); | 119 | console.log('Added ' + this.video.magnetUri + '.'); |
118 | torrent.files[0].renderTo(this.playerElement, { autoplay: true }, (err) => { | 120 | torrent.files[0].renderTo(this.playerElement, { autoplay: true }, (err) => { |
119 | if (err) { | 121 | if (err) { |
120 | alert('Cannot append the file.'); | 122 | this.notificationsService.error('Error', 'Cannot append the file in the video element.'); |
121 | console.error(err); | 123 | console.error(err); |
122 | } | 124 | } |
123 | }); | 125 | }); |