aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.html6
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts26
2 files changed, 32 insertions, 0 deletions
diff --git a/client/src/app/videos/+video-watch/video-watch.component.html b/client/src/app/videos/+video-watch/video-watch.component.html
index e3214a331..e9ca336dd 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.html
+++ b/client/src/app/videos/+video-watch/video-watch.component.html
@@ -49,6 +49,12 @@
49 <span class="icon icon-blacklist"></span> Blacklist 49 <span class="icon icon-blacklist"></span> Blacklist
50 </a> 50 </a>
51 </li> 51 </li>
52
53 <li *ngIf="isVideoRemovable()" role="menuitem">
54 <a class="dropdown-item" title="Delete this video" href="#" (click)="removeVideo($event)">
55 <span class="icon icon-blacklist"></span> Delete
56 </a>
57 </li>
52 </ul> 58 </ul>
53 </div> 59 </div>
54 </div> 60 </div>
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()