From 2e401e8575decb1d491d0db48ca1ab1eba5b2a66 Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Tue, 21 Jun 2022 15:31:25 +0200 Subject: store uploaded video filename (#4885) * store uploaded video filename closes #4731 * dont crash if videos channel exist * migration: use raw query * video source: fixes after code review * cleanup * bump migration * updates after code review * refactor: use checkUserCanManageVideo * videoSource: add openapi doc * test(check-params/video-source): fix timeout * Styling * Correctly set original filename as source Co-authored-by: Chocobozzz --- .../+videos/+video-edit/shared/video-edit.component.html | 15 +++++++++++++++ .../+videos/+video-edit/shared/video-edit.component.ts | 2 ++ .../app/+videos/+video-edit/video-update.component.html | 1 + .../src/app/+videos/+video-edit/video-update.component.ts | 5 ++++- .../src/app/+videos/+video-edit/video-update.resolver.ts | 5 ++++- 5 files changed, 26 insertions(+), 2 deletions(-) (limited to 'client/src/app/+videos/+video-edit') diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.html b/client/src/app/+videos/+video-edit/shared/video-edit.component.html index 595200c3b..650448a74 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.html +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.html @@ -340,6 +340,21 @@
+ +
+ + + + + + Name of the uploaded file + + + + + +
+
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts index 16b964482..c74ef5731 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts @@ -37,6 +37,7 @@ import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service' import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' import { VideoCaptionEditModalComponent } from './video-caption-edit-modal/video-caption-edit-modal.component' import { VideoEditType } from './video-edit.type' +import { VideoSource } from '@shared/models/videos/video-source' type VideoLanguages = VideoConstant & { group?: string } type PluginField = { @@ -61,6 +62,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { @Input() forbidScheduledPublication = true @Input() videoCaptions: VideoCaptionWithPathEdit[] = [] + @Input() videoSource: VideoSource @Input() waitTranscodingEnabled = true @Input() type: VideoEditType diff --git a/client/src/app/+videos/+video-edit/video-update.component.html b/client/src/app/+videos/+video-edit/video-update.component.html index 6a32f1477..ffd125695 100644 --- a/client/src/app/+videos/+video-edit/video-update.component.html +++ b/client/src/app/+videos/+video-edit/video-update.component.html @@ -12,6 +12,7 @@ [videoCaptions]="videoCaptions" [waitTranscodingEnabled]="isWaitTranscodingEnabled()" type="update" (pluginFieldsAdded)="hydratePluginFieldsFromVideo()" [liveVideo]="liveVideo" [videoToUpdate]="videoDetails" + [videoSource]="videoSource" (formBuilt)="onFormBuilt()" > 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 9c4998f2e..43e8ba3e5 100644 --- a/client/src/app/+videos/+video-edit/video-update.component.ts +++ b/client/src/app/+videos/+video-edit/video-update.component.ts @@ -10,6 +10,7 @@ import { LiveVideoService } from '@app/shared/shared-video-live' import { LoadingBarService } from '@ngx-loading-bar/core' import { LiveVideo, LiveVideoUpdate, VideoPrivacy } from '@shared/models' import { hydrateFormFromVideo } from './shared/video-edit-utils' +import { VideoSource } from '@shared/models/videos/video-source' @Component({ selector: 'my-videos-update', @@ -19,6 +20,7 @@ import { hydrateFormFromVideo } from './shared/video-edit-utils' export class VideoUpdateComponent extends FormReactive implements OnInit { video: VideoEdit videoDetails: VideoDetails + videoSource: VideoSource userVideoChannels: SelectChannelItem[] = [] videoCaptions: VideoCaptionEdit[] = [] liveVideo: LiveVideo @@ -46,13 +48,14 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { this.buildForm({}) const { videoData } = this.route.snapshot.data - const { video, videoChannels, videoCaptions, liveVideo } = videoData + const { video, videoChannels, videoCaptions, videoSource, liveVideo } = videoData this.video = new VideoEdit(video) this.videoDetails = video this.userVideoChannels = videoChannels this.videoCaptions = videoCaptions + this.videoSource = videoSource this.liveVideo = liveVideo this.forbidScheduledPublication = this.video.privacy !== VideoPrivacy.PRIVATE diff --git a/client/src/app/+videos/+video-edit/video-update.resolver.ts b/client/src/app/+videos/+video-edit/video-update.resolver.ts index 82dae5c1c..db5017340 100644 --- a/client/src/app/+videos/+video-edit/video-update.resolver.ts +++ b/client/src/app/+videos/+video-edit/video-update.resolver.ts @@ -23,7 +23,8 @@ export class VideoUpdateResolver implements Resolve { return this.videoService.getVideo({ videoId: uuid }) .pipe( switchMap(video => forkJoin(this.buildVideoObservables(video))), - map(([ video, videoChannels, videoCaptions, liveVideo ]) => ({ video, videoChannels, videoCaptions, liveVideo })) + map(([ video, videoSource, videoChannels, videoCaptions, liveVideo ]) => + ({ video, videoChannels, videoCaptions, videoSource, liveVideo })) ) } @@ -33,6 +34,8 @@ export class VideoUpdateResolver implements Resolve { .loadCompleteDescription(video.descriptionPath) .pipe(map(description => Object.assign(video, { description }))), + this.videoService.getSource(video.id), + listUserChannelsForSelect(this.authService), this.videoCaptionService -- cgit v1.2.3