From e7c89cc3f3e69776c6ad62e62a52f8d2f12a81c1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 14 Apr 2023 09:57:37 +0200 Subject: Allow to update a live with untouched privacy --- client/src/app/+videos/+video-edit/video-update.component.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'client/src') 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 412b43967..b70270261 100644 --- a/client/src/app/+videos/+video-edit/video-update.component.ts +++ b/client/src/app/+videos/+video-edit/video-update.component.ts @@ -9,6 +9,7 @@ import { Video, VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, import { LiveVideoService } from '@app/shared/shared-video-live' import { LoadingBarService } from '@ngx-loading-bar/core' import { logger } from '@root-helpers/logger' +import { pick, simpleObjectsDeepEqual } from '@shared/core-utils' import { LiveVideo, LiveVideoUpdate, VideoPrivacy } from '@shared/models' import { VideoSource } from '@shared/models/videos/video-source' import { hydrateFormFromVideo } from './shared/video-edit-utils' @@ -134,8 +135,8 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { } // Don't update live attributes if they did not change - const liveChanged = Object.keys(liveVideoUpdate) - .some(key => this.liveVideo[key] !== liveVideoUpdate[key]) + const baseVideo = pick(this.liveVideo, Object.keys(liveVideoUpdate) as (keyof LiveVideoUpdate)[]) + const liveChanged = !simpleObjectsDeepEqual(baseVideo, liveVideoUpdate) if (!liveChanged) return of(undefined) return this.liveVideoService.updateLive(this.videoEdit.id, liveVideoUpdate) -- cgit v1.2.3