From 6221f311de0eb8f2a9e7e4a77b8cb0ecbde6dfcd Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 22 Feb 2018 09:03:45 +0100 Subject: Add ability to update another user video --- client/src/app/shared/video/video-details.model.ts | 2 +- client/src/app/videos/+video-edit/video-update.component.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'client/src') diff --git a/client/src/app/shared/video/video-details.model.ts b/client/src/app/shared/video/video-details.model.ts index 4e4f64c7b..a22ed68da 100644 --- a/client/src/app/shared/video/video-details.model.ts +++ b/client/src/app/shared/video/video-details.model.ts @@ -88,6 +88,6 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { } isUpdatableBy (user: AuthUser) { - return user && this.isLocal === true && user.username === this.accountName + return user && this.isLocal === true && (this.accountName === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO)) } } diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.ts index d97e00a3a..2fc09278c 100644 --- a/client/src/app/videos/+video-edit/video-update.component.ts +++ b/client/src/app/videos/+video-edit/video-update.component.ts @@ -53,9 +53,6 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { this.serverService.videoPrivaciesLoaded .subscribe(() => this.videoPrivacies = this.serverService.getVideoPrivacies()) - populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) - .catch(err => console.error('Cannot populate async user video channels.', err)) - const uuid: string = this.route.snapshot.params['uuid'] this.videoService.getVideo(uuid) .switchMap(video => { @@ -67,6 +64,13 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { video => { this.video = new VideoEdit(video) + this.userVideoChannels = [ + { + id: video.channel.id, + label: video.channel.displayName + } + ] + // We cannot set private a video that was not private if (video.privacy !== VideoPrivacy.PRIVATE) { const newVideoPrivacies = [] -- cgit v1.2.3