diff options
Diffstat (limited to 'client/src/app/videos/+video-watch/video-watch.component.ts')
-rw-r--r-- | client/src/app/videos/+video-watch/video-watch.component.ts | 26 |
1 files changed, 26 insertions, 0 deletions
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 adb698e99..df4cfa666 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -221,6 +221,32 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
221 | return this.video.tags.join(', ') | 221 | return this.video.tags.join(', ') |
222 | } | 222 | } |
223 | 223 | ||
224 | isVideoRemovable () { | ||
225 | return this.video.isRemovableBy(this.authService.getUser()) | ||
226 | } | ||
227 | |||
228 | removeVideo (event: Event) { | ||
229 | event.preventDefault() | ||
230 | |||
231 | this.confirmService.confirm('Do you really want to delete this video?', 'Delete').subscribe( | ||
232 | res => { | ||
233 | if (res === false) return | ||
234 | |||
235 | this.videoService.removeVideo(this.video.id) | ||
236 | .subscribe( | ||
237 | status => { | ||
238 | this.notificationsService.success('Success', `Video ${this.video.name} deleted.`) | ||
239 | |||
240 | // Go back to the video-list. | ||
241 | this.router.navigate([ '/videos/list' ]) | ||
242 | }, | ||
243 | |||
244 | error => this.notificationsService.error('Error', error.text) | ||
245 | ) | ||
246 | } | ||
247 | ) | ||
248 | } | ||
249 | |||
224 | private updateVideoDescription (description: string) { | 250 | private updateVideoDescription (description: string) { |
225 | this.video.description = description | 251 | this.video.description = description |
226 | this.setVideoDescriptionHTML() | 252 | this.setVideoDescriptionHTML() |