diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-04 16:21:07 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-04 17:31:28 +0200 |
commit | 8cd7faaa331f83903f0bbaead288661218e38bdb (patch) | |
tree | 82e16eb1f7d4d7d259de9aab74c9865fd2ec7081 /client/src/app/videos/+video-edit | |
parent | a94419a604f324305c9dbb607496a5bca9b63d04 (diff) | |
download | PeerTube-8cd7faaa331f83903f0bbaead288661218e38bdb.tar.gz PeerTube-8cd7faaa331f83903f0bbaead288661218e38bdb.tar.zst PeerTube-8cd7faaa331f83903f0bbaead288661218e38bdb.zip |
Better label for video privacies
Diffstat (limited to 'client/src/app/videos/+video-edit')
6 files changed, 17 insertions, 7 deletions
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' | |||
12 | import { VideoCaptionAddModalComponent } from '@app/videos/+video-edit/shared/video-caption-add-modal.component' | 12 | import { VideoCaptionAddModalComponent } from '@app/videos/+video-edit/shared/video-caption-add-modal.component' |
13 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' | 13 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' |
14 | import { removeElementFromArray } from '@app/shared/misc/utils' | 14 | import { removeElementFromArray } from '@app/shared/misc/utils' |
15 | import { VideoConstant } from '../../../../../../shared' | 15 | import { VideoConstant, VideoPrivacy } from '../../../../../../shared' |
16 | 16 | ||
17 | @Component({ | 17 | @Component({ |
18 | selector: 'my-video-edit', | 18 | selector: 'my-video-edit', |
@@ -23,7 +23,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
23 | @Input() form: FormGroup | 23 | @Input() form: FormGroup |
24 | @Input() formErrors: { [ id: string ]: string } = {} | 24 | @Input() formErrors: { [ id: string ]: string } = {} |
25 | @Input() validationMessages: FormReactiveValidationMessages = {} | 25 | @Input() validationMessages: FormReactiveValidationMessages = {} |
26 | @Input() videoPrivacies: { id: number, label: string }[] = [] | 26 | @Input() videoPrivacies: VideoConstant<VideoPrivacy>[] = [] |
27 | @Input() userVideoChannels: { id: number, label: string, support: string }[] = [] | 27 | @Input() userVideoChannels: { id: number, label: string, support: string }[] = [] |
28 | @Input() schedulePublicationPossible = true | 28 | @Input() schedulePublicationPossible = true |
29 | @Input() videoCaptions: VideoCaptionEdit[] = [] | 29 | @Input() videoCaptions: VideoCaptionEdit[] = [] |
@@ -33,8 +33,8 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
33 | // So that it can be accessed in the template | 33 | // So that it can be accessed in the template |
34 | readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY | 34 | readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY |
35 | 35 | ||
36 | videoCategories: VideoConstant<string>[] = [] | 36 | videoCategories: VideoConstant<number>[] = [] |
37 | videoLicences: VideoConstant<string>[] = [] | 37 | videoLicences: VideoConstant<number>[] = [] |
38 | videoLanguages: VideoConstant<string>[] = [] | 38 | videoLanguages: VideoConstant<string>[] = [] |
39 | 39 | ||
40 | tagValidators: ValidatorFn[] | 40 | 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 | |||
95 | thumbnailUrl: null, | 95 | thumbnailUrl: null, |
96 | previewUrl: null | 96 | previewUrl: null |
97 | })) | 97 | })) |
98 | |||
99 | this.videoPrivacies = this.videoService.explainedPrivacyLabels(this.videoPrivacies) | ||
100 | |||
98 | this.hydrateFormFromVideo() | 101 | this.hydrateFormFromVideo() |
99 | }, | 102 | }, |
100 | 103 | ||
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 | |||
87 | thumbnailUrl: null, | 87 | thumbnailUrl: null, |
88 | previewUrl: null | 88 | previewUrl: null |
89 | })) | 89 | })) |
90 | |||
91 | this.videoPrivacies = this.videoService.explainedPrivacyLabels(this.videoPrivacies) | ||
92 | |||
90 | this.hydrateFormFromVideo() | 93 | this.hydrateFormFromVideo() |
91 | }, | 94 | }, |
92 | 95 | ||
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' | |||
15 | export abstract class VideoSend extends FormReactive implements OnInit, CanComponentDeactivate { | 15 | export abstract class VideoSend extends FormReactive implements OnInit, CanComponentDeactivate { |
16 | 16 | ||
17 | userVideoChannels: { id: number, label: string, support: string }[] = [] | 17 | userVideoChannels: { id: number, label: string, support: string }[] = [] |
18 | videoPrivacies: VideoConstant<string>[] = [] | 18 | videoPrivacies: VideoConstant<VideoPrivacy>[] = [] |
19 | videoCaptions: VideoCaptionEdit[] = [] | 19 | videoCaptions: VideoCaptionEdit[] = [] |
20 | 20 | ||
21 | firstStepPrivacyId = 0 | 21 | 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 | |||
182 | channelId | 182 | channelId |
183 | }) | 183 | }) |
184 | 184 | ||
185 | this.videoPrivacies = this.videoService.explainedPrivacyLabels(this.videoPrivacies) | ||
186 | |||
185 | this.videoUploadObservable = this.videoService.uploadVideo(formData).subscribe( | 187 | this.videoUploadObservable = this.videoService.uploadVideo(formData).subscribe( |
186 | event => { | 188 | event => { |
187 | if (event.type === HttpEventType.UploadProgress) { | 189 | 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 { | |||
24 | video: VideoEdit | 24 | video: VideoEdit |
25 | 25 | ||
26 | isUpdatingVideo = false | 26 | isUpdatingVideo = false |
27 | videoPrivacies: VideoConstant<string>[] = [] | 27 | videoPrivacies: VideoConstant<VideoPrivacy>[] = [] |
28 | userVideoChannels: { id: number, label: string, support: string }[] = [] | 28 | userVideoChannels: { id: number, label: string, support: string }[] = [] |
29 | schedulePublicationPossible = false | 29 | schedulePublicationPossible = false |
30 | videoCaptions: VideoCaptionEdit[] = [] | 30 | videoCaptions: VideoCaptionEdit[] = [] |
@@ -62,11 +62,13 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
62 | 62 | ||
63 | // We cannot set private a video that was not private | 63 | // We cannot set private a video that was not private |
64 | if (this.video.privacy !== VideoPrivacy.PRIVATE) { | 64 | if (this.video.privacy !== VideoPrivacy.PRIVATE) { |
65 | this.videoPrivacies = this.videoPrivacies.filter(p => p.id.toString() !== VideoPrivacy.PRIVATE.toString()) | 65 | this.videoPrivacies = this.videoPrivacies.filter(p => p.id !== VideoPrivacy.PRIVATE) |
66 | } else { // We can schedule video publication only if it it is private | 66 | } else { // We can schedule video publication only if it it is private |
67 | this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE | 67 | this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE |
68 | } | 68 | } |
69 | 69 | ||
70 | this.videoPrivacies = this.videoService.explainedPrivacyLabels(this.videoPrivacies) | ||
71 | |||
70 | // FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout | 72 | // FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout |
71 | setTimeout(() => this.hydrateFormFromVideo()) | 73 | setTimeout(() => this.hydrateFormFromVideo()) |
72 | }, | 74 | }, |