From 329d9086601b7ae2127be12166ee8c892c289c6e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 16 Jul 2018 15:24:50 +0200 Subject: Do not display private privacy if the video is not private --- client/src/app/shared/video-caption/video-caption.service.ts | 4 +++- client/src/app/videos/+video-edit/video-update.component.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'client') diff --git a/client/src/app/shared/video-caption/video-caption.service.ts b/client/src/app/shared/video-caption/video-caption.service.ts index 4ae8ebd0a..d1444902d 100644 --- a/client/src/app/shared/video-caption/video-caption.service.ts +++ b/client/src/app/shared/video-caption/video-caption.service.ts @@ -1,7 +1,7 @@ import { catchError, map } from 'rxjs/operators' import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' -import { forkJoin, Observable } from 'rxjs' +import { forkJoin, Observable, of } from 'rxjs' import { ResultList } from '../../../../../shared' import { RestExtractor, RestService } from '../rest' import { VideoCaption } from '../../../../../shared/models/videos/video-caption.model' @@ -42,6 +42,8 @@ export class VideoCaptionService { } updateCaptions (videoId: number | string, videoCaptions: VideoCaptionEdit[]) { + if (videoCaptions.length === 0) return of(true) + const observables: Observable[] = [] for (const videoCaption of videoCaptions) { 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 b67874401..72fcc8659 100644 --- a/client/src/app/videos/+video-edit/video-update.component.ts +++ b/client/src/app/videos/+video-edit/video-update.component.ts @@ -84,7 +84,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { // We cannot set private a video that was not private if (this.video.privacy !== VideoPrivacy.PRIVATE) { - this.videoPrivacies = this.videoPrivacies.filter(p => p.id !== VideoPrivacy.PRIVATE) + this.videoPrivacies = this.videoPrivacies.filter(p => p.id.toString() !== VideoPrivacy.PRIVATE.toString()) } else { // We can schedule video publication only if it it is private this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE } -- cgit v1.2.3