Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Do not override privacy for imports and live

Chocobozzz0882d9662464
diff --git a/client/src/app/+videos-publish-manage/+video-publish/import/video-import-torrent.component.ts b/client/src/app/+videos-publish-manage/+video-publish/import/video-import-torrent.component.ts
index 9fc12a238e..2158ab55ae 100644
--- a/client/src/app/+videos-publish-manage/+video-publish/import/video-import-torrent.component.ts
+++ b/client/src/app/+videos-publish-manage/+video-publish/import/video-import-torrent.component.ts
@@ -132,7 +132,7 @@ export class VideoImportTorrentComponent implements OnInit, AfterViewInit, CanCo
.pipe(switchMap(({ video }) => this.videoService.getVideo({ videoId: video.uuid })))
.subscribe({
next: async video => {
- await videoEdit.loadFromAPI({ video })
+ await videoEdit.loadFromAPI({ video, loadPrivacy: false })
this.loadingBar.useRef().complete()
diff --git a/client/src/app/+videos-publish-manage/+video-publish/import/video-import-url.component.ts b/client/src/app/+videos-publish-manage/+video-publish/import/video-import-url.component.ts
index cf221ba934..6fe9106ffb 100644
--- a/client/src/app/+videos-publish-manage/+video-publish/import/video-import-url.component.ts
+++ b/client/src/app/+videos-publish-manage/+video-publish/import/video-import-url.component.ts
@@ -130,7 +130,7 @@ export class VideoImportUrlComponent implements OnInit, AfterViewInit, CanCompon
)
.subscribe({
next: async ({ video, captions, chapters }) => {
- await videoEdit.loadFromAPI({ video, captions, chapters })
+ await videoEdit.loadFromAPI({ video, captions, chapters, loadPrivacy: false })
this.loadingBar.useRef().complete()
diff --git a/client/src/app/+videos-publish-manage/+video-publish/live/video-go-live.component.ts b/client/src/app/+videos-publish-manage/+video-publish/live/video-go-live.component.ts
index fb91731f96..e6d75e4f5f 100644
--- a/client/src/app/+videos-publish-manage/+video-publish/live/video-go-live.component.ts
+++ b/client/src/app/+videos-publish-manage/+video-publish/live/video-go-live.component.ts
@@ -105,7 +105,7 @@ export class VideoGoLiveComponent implements OnInit, AfterViewInit, CanComponent
.subscribe({
next: async ({ video: { id, uuid, shortUUID }, live }) => {
videoEdit.loadAfterPublish({ video: { id, uuid, shortUUID } })
- await videoEdit.loadFromAPI({ live })
+ await videoEdit.loadFromAPI({ live, loadPrivacy: false })
debugLogger(`Live published`)
diff --git a/client/src/app/+videos-publish-manage/shared-manage/common/video-edit.model.ts b/client/src/app/+videos-publish-manage/shared-manage/common/video-edit.model.ts
index a2976728cd..edce9c2556 100644
--- a/client/src/app/+videos-publish-manage/shared-manage/common/video-edit.model.ts
+++ b/client/src/app/+videos-publish-manage/shared-manage/common/video-edit.model.ts
@@ -293,12 +293,12 @@ export class VideoEdit {
return videoEdit
}
- async loadFromAPI (options: UpdateFromAPIOptions) {
- const { video, videoPasswords, live, chapters, captions, videoSource } = options
+ async loadFromAPI (options: UpdateFromAPIOptions & { loadPrivacy?: boolean }) {
+ const { video, videoPasswords, live, chapters, captions, videoSource, loadPrivacy = true } = options
debugLogger('Load from API', options)
- this.loadVideo({ video, videoPasswords, saveInStore: true })
+ this.loadVideo({ video, videoPasswords, saveInStore: true, loadPrivacy })
this.loadLive(live)
if (captions !== undefined) {
@@ -322,18 +322,21 @@ export class VideoEdit {
private loadVideo (options: {
video: UpdateFromAPIOptions['video']
videoPasswords?: string[]
+ loadPrivacy?: boolean // default true
saveInStore: boolean
}) {
- const { video, saveInStore, videoPasswords = [] } = options
+ const { video, saveInStore, loadPrivacy = true, videoPasswords = [] } = options
if (video === undefined) return
- const buildObj: () => CommonUpdate = () => {
- return {
+ const buildObj: (options: { loadPrivacy: boolean }) => CommonUpdate = () => {
+ const { loadPrivacy } = options
+
+ const base = {
...this.common,
name: video.name || '',
- privacy: video.privacy?.id ?? null,
+
channelId: video.channel?.id ?? null,
category: video.category?.id ?? null,
licence: video.licence?.id ?? null,
@@ -361,12 +364,18 @@ export class VideoEdit {
videoPasswords: videoPasswords ?? []
}
+
+ if (loadPrivacy) {
+ return { ...base, privacy: video.privacy?.id ?? null }
+ }
+
+ return base
}
- this.common = buildObj()
+ this.common = buildObj({ loadPrivacy })
if (saveInStore) {
- const obj = buildObj()
+ const obj = buildObj({ loadPrivacy: true })
this.saveStore.common = omit(obj, [ 'pluginData', 'previewfile' ])
// Apply plugin defaults so we correctly detect changes