diff options
Diffstat (limited to 'client/src/app/videos')
-rw-r--r-- | client/src/app/videos/video-list/video-miniature.component.ts | 18 | ||||
-rw-r--r-- | client/src/app/videos/video-watch/video-report.component.ts | 14 |
2 files changed, 19 insertions, 13 deletions
diff --git a/client/src/app/videos/video-list/video-miniature.component.ts b/client/src/app/videos/video-list/video-miniature.component.ts index ca4afc451..ba4715597 100644 --- a/client/src/app/videos/video-list/video-miniature.component.ts +++ b/client/src/app/videos/video-list/video-miniature.component.ts | |||
@@ -2,6 +2,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core'; | |||
2 | 2 | ||
3 | import { NotificationsService } from 'angular2-notifications'; | 3 | import { NotificationsService } from 'angular2-notifications'; |
4 | 4 | ||
5 | import { ConfirmService } from '../../core'; | ||
5 | import { SortField, Video, VideoService } from '../shared'; | 6 | import { SortField, Video, VideoService } from '../shared'; |
6 | import { User } from '../../shared'; | 7 | import { User } from '../../shared'; |
7 | 8 | ||
@@ -22,6 +23,7 @@ export class VideoMiniatureComponent { | |||
22 | 23 | ||
23 | constructor( | 24 | constructor( |
24 | private notificationsService: NotificationsService, | 25 | private notificationsService: NotificationsService, |
26 | private confirmService: ConfirmService, | ||
25 | private videoService: VideoService | 27 | private videoService: VideoService |
26 | ) {} | 28 | ) {} |
27 | 29 | ||
@@ -38,12 +40,16 @@ export class VideoMiniatureComponent { | |||
38 | } | 40 | } |
39 | 41 | ||
40 | removeVideo(id: string) { | 42 | removeVideo(id: string) { |
41 | if (confirm('Do you really want to remove this video?')) { | 43 | this.confirmService.confirm('Do you really want to delete this video?', 'Delete').subscribe( |
42 | this.videoService.removeVideo(id).subscribe( | 44 | res => { |
43 | status => this.removed.emit(true), | 45 | if (res === false) return; |
44 | 46 | ||
45 | error => this.notificationsService.error('Error', error.text) | 47 | this.videoService.removeVideo(id).subscribe( |
46 | ); | 48 | status => this.removed.emit(true), |
47 | } | 49 | |
50 | error => this.notificationsService.error('Error', error.text) | ||
51 | ); | ||
52 | } | ||
53 | ); | ||
48 | } | 54 | } |
49 | } | 55 | } |
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..7906fdb5c 100644 --- a/client/src/app/videos/video-watch/video-report.component.ts +++ b/client/src/app/videos/video-watch/video-report.component.ts | |||
@@ -57,13 +57,13 @@ export class VideoReportComponent extends FormReactive implements OnInit { | |||
57 | const reason = this.form.value['reason'] | 57 | const reason = this.form.value['reason'] |
58 | 58 | ||
59 | this.videoAbuseService.reportVideo(this.video.id, reason) | 59 | this.videoAbuseService.reportVideo(this.video.id, reason) |
60 | .subscribe( | 60 | .subscribe( |
61 | () => { | 61 | () => { |
62 | this.notificationsService.success('Success', 'Video reported.'); | 62 | this.notificationsService.success('Success', 'Video reported.'); |
63 | this.hide(); | 63 | this.hide(); |
64 | }, | 64 | }, |
65 | 65 | ||
66 | err => this.notificationsService.error('Error', err.text); | 66 | err => this.notificationsService.error('Error', err.text) |
67 | ) | 67 | ); |
68 | } | 68 | } |
69 | } | 69 | } |