From 8cd7faaa331f83903f0bbaead288661218e38bdb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 4 Sep 2018 16:21:07 +0200 Subject: Better label for video privacies --- client/src/app/videos/+video-edit/shared/video-edit.component.ts | 8 ++++---- .../video-add-components/video-import-torrent.component.ts | 3 +++ .../video-add-components/video-import-url.component.ts | 3 +++ .../src/app/videos/+video-edit/video-add-components/video-send.ts | 2 +- .../+video-edit/video-add-components/video-upload.component.ts | 2 ++ client/src/app/videos/+video-edit/video-update.component.ts | 6 ++++-- 6 files changed, 17 insertions(+), 7 deletions(-) (limited to 'client/src/app/videos') 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 b394a13e4..eb9396d70 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 @@ -12,7 +12,7 @@ import { VideoCaptionService } from '@app/shared/video-caption' import { VideoCaptionAddModalComponent } from '@app/videos/+video-edit/shared/video-caption-add-modal.component' import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' import { removeElementFromArray } from '@app/shared/misc/utils' -import { VideoConstant } from '../../../../../../shared' +import { VideoConstant, VideoPrivacy } from '../../../../../../shared' @Component({ selector: 'my-video-edit', @@ -23,7 +23,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { @Input() form: FormGroup @Input() formErrors: { [ id: string ]: string } = {} @Input() validationMessages: FormReactiveValidationMessages = {} - @Input() videoPrivacies: { id: number, label: string }[] = [] + @Input() videoPrivacies: VideoConstant[] = [] @Input() userVideoChannels: { id: number, label: string, support: string }[] = [] @Input() schedulePublicationPossible = true @Input() videoCaptions: VideoCaptionEdit[] = [] @@ -33,8 +33,8 @@ export class VideoEditComponent implements OnInit, OnDestroy { // So that it can be accessed in the template readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY - videoCategories: VideoConstant[] = [] - videoLicences: VideoConstant[] = [] + videoCategories: VideoConstant[] = [] + videoLicences: VideoConstant[] = [] videoLanguages: VideoConstant[] = [] tagValidators: ValidatorFn[] diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index 9623c2bf4..0f7184ff8 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts @@ -95,6 +95,9 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca thumbnailUrl: null, previewUrl: null })) + + this.videoPrivacies = this.videoService.explainedPrivacyLabels(this.videoPrivacies) + this.hydrateFormFromVideo() }, diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts index 97b402bfe..031e557ed 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts @@ -87,6 +87,9 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom thumbnailUrl: null, previewUrl: null })) + + this.videoPrivacies = this.videoService.explainedPrivacyLabels(this.videoPrivacies) + this.hydrateFormFromVideo() }, diff --git a/client/src/app/videos/+video-edit/video-add-components/video-send.ts b/client/src/app/videos/+video-edit/video-add-components/video-send.ts index efd182269..bfe588676 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-send.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-send.ts @@ -15,7 +15,7 @@ import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' export abstract class VideoSend extends FormReactive implements OnInit, CanComponentDeactivate { userVideoChannels: { id: number, label: string, support: string }[] = [] - videoPrivacies: VideoConstant[] = [] + videoPrivacies: VideoConstant[] = [] videoCaptions: VideoCaptionEdit[] = [] firstStepPrivacyId = 0 diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts index b59fb7335..f9af1655b 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts @@ -182,6 +182,8 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy channelId }) + this.videoPrivacies = this.videoService.explainedPrivacyLabels(this.videoPrivacies) + this.videoUploadObservable = this.videoService.uploadVideo(formData).subscribe( event => { if (event.type === HttpEventType.UploadProgress) { 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 0c60e3439..75b11f46c 100644 --- a/client/src/app/videos/+video-edit/video-update.component.ts +++ b/client/src/app/videos/+video-edit/video-update.component.ts @@ -24,7 +24,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { video: VideoEdit isUpdatingVideo = false - videoPrivacies: VideoConstant[] = [] + videoPrivacies: VideoConstant[] = [] userVideoChannels: { id: number, label: string, support: string }[] = [] schedulePublicationPossible = false videoCaptions: VideoCaptionEdit[] = [] @@ -62,11 +62,13 @@ 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.toString() !== VideoPrivacy.PRIVATE.toString()) + this.videoPrivacies = this.videoPrivacies.filter(p => p.id !== VideoPrivacy.PRIVATE) } else { // We can schedule video publication only if it it is private this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE } + this.videoPrivacies = this.videoService.explainedPrivacyLabels(this.videoPrivacies) + // FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout setTimeout(() => this.hydrateFormFromVideo()) }, -- cgit v1.2.3