diff options
author | Chocobozzz <me@florianbigard.com> | 2021-01-26 15:28:38 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-01-26 15:28:38 +0100 |
commit | fd0fdc46961ff9aa5c04e1c73b9b4e5e0cbbda8b (patch) | |
tree | f283f2291a8b37bed82bfdddac59281a45dcfe78 /client/src/app/+videos | |
parent | e9cb361cf51d11ef603128fb6715c103becf5123 (diff) | |
download | PeerTube-fd0fdc46961ff9aa5c04e1c73b9b4e5e0cbbda8b.tar.gz PeerTube-fd0fdc46961ff9aa5c04e1c73b9b4e5e0cbbda8b.tar.zst PeerTube-fd0fdc46961ff9aa5c04e1c73b9b4e5e0cbbda8b.zip |
Don't update live attributes if they did not change
Diffstat (limited to 'client/src/app/+videos')
-rw-r--r-- | client/src/app/+videos/+video-edit/video-update.component.ts | 18 |
1 files changed, 13 insertions, 5 deletions
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 e2331c148..f27ebd20e 100644 --- a/client/src/app/+videos/+video-edit/video-update.component.ts +++ b/client/src/app/+videos/+video-edit/video-update.component.ts | |||
@@ -124,11 +124,6 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
124 | 124 | ||
125 | this.video.patch(this.form.value) | 125 | this.video.patch(this.form.value) |
126 | 126 | ||
127 | const liveVideoUpdate: LiveVideoUpdate = { | ||
128 | saveReplay: this.form.value.saveReplay, | ||
129 | permanentLive: this.form.value.permanentLive | ||
130 | } | ||
131 | |||
132 | this.loadingBar.useRef().start() | 127 | this.loadingBar.useRef().start() |
133 | this.isUpdatingVideo = true | 128 | this.isUpdatingVideo = true |
134 | 129 | ||
@@ -141,6 +136,19 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
141 | switchMap(() => { | 136 | switchMap(() => { |
142 | if (!this.liveVideo) return of(undefined) | 137 | if (!this.liveVideo) return of(undefined) |
143 | 138 | ||
139 | const liveVideoUpdate: LiveVideoUpdate = { | ||
140 | saveReplay: this.form.value.saveReplay, | ||
141 | permanentLive: this.form.value.permanentLive | ||
142 | } | ||
143 | |||
144 | console.log(liveVideoUpdate) | ||
145 | console.log(this.form.value) | ||
146 | |||
147 | // Don't update live attributes if they did not change | ||
148 | const liveChanged = Object.keys(liveVideoUpdate) | ||
149 | .some(key => this.liveVideo[key] !== liveVideoUpdate[key]) | ||
150 | if (!liveChanged) return of(undefined) | ||
151 | |||
144 | return this.liveVideoService.updateLive(this.video.id, liveVideoUpdate) | 152 | return this.liveVideoService.updateLive(this.video.id, liveVideoUpdate) |
145 | }) | 153 | }) |
146 | ) | 154 | ) |