diff options
Diffstat (limited to 'client/src/app/+videos/+video-edit/shared/video-edit.component.ts')
-rw-r--r-- | client/src/app/+videos/+video-edit/shared/video-edit.component.ts | 38 |
1 files changed, 30 insertions, 8 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 239e453ad..4cd3838de 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 | |||
@@ -8,6 +8,11 @@ import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-ma | |||
8 | import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models' | 8 | import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models' |
9 | import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service' | 9 | import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service' |
10 | import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' | 10 | import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' |
11 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
12 | import { forkJoin } from 'rxjs' | ||
13 | import { InstanceService } from '@app/shared/shared-instance' | ||
14 | |||
15 | type VideoLanguages = VideoConstant<string> & { group?: string } | ||
11 | 16 | ||
12 | @Component({ | 17 | @Component({ |
13 | selector: 'my-video-edit', | 18 | selector: 'my-video-edit', |
@@ -31,7 +36,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
31 | videoPrivacies: VideoConstant<VideoPrivacy>[] = [] | 36 | videoPrivacies: VideoConstant<VideoPrivacy>[] = [] |
32 | videoCategories: VideoConstant<number>[] = [] | 37 | videoCategories: VideoConstant<number>[] = [] |
33 | videoLicences: VideoConstant<number>[] = [] | 38 | videoLicences: VideoConstant<number>[] = [] |
34 | videoLanguages: VideoConstant<string>[] = [] | 39 | videoLanguages: VideoLanguages[] = [] |
35 | 40 | ||
36 | tagValidators: ValidatorFn[] | 41 | tagValidators: ValidatorFn[] |
37 | tagValidatorsMessages: { [ name: string ]: string } | 42 | tagValidatorsMessages: { [ name: string ]: string } |
@@ -56,12 +61,11 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
56 | private videoValidatorsService: VideoValidatorsService, | 61 | private videoValidatorsService: VideoValidatorsService, |
57 | private videoService: VideoService, | 62 | private videoService: VideoService, |
58 | private serverService: ServerService, | 63 | private serverService: ServerService, |
64 | private instanceService: InstanceService, | ||
59 | private i18nPrimengCalendarService: I18nPrimengCalendarService, | 65 | private i18nPrimengCalendarService: I18nPrimengCalendarService, |
66 | private i18n: I18n, | ||
60 | private ngZone: NgZone | 67 | private ngZone: NgZone |
61 | ) { | 68 | ) { |
62 | this.tagValidators = this.videoValidatorsService.VIDEO_TAGS.VALIDATORS | ||
63 | this.tagValidatorsMessages = this.videoValidatorsService.VIDEO_TAGS.MESSAGES | ||
64 | |||
65 | this.calendarLocale = this.i18nPrimengCalendarService.getCalendarLocale() | 69 | this.calendarLocale = this.i18nPrimengCalendarService.getCalendarLocale() |
66 | this.calendarTimezone = this.i18nPrimengCalendarService.getTimezone() | 70 | this.calendarTimezone = this.i18nPrimengCalendarService.getTimezone() |
67 | this.calendarDateFormat = this.i18nPrimengCalendarService.getDateFormat() | 71 | this.calendarDateFormat = this.i18nPrimengCalendarService.getDateFormat() |
@@ -93,7 +97,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
93 | licence: this.videoValidatorsService.VIDEO_LICENCE, | 97 | licence: this.videoValidatorsService.VIDEO_LICENCE, |
94 | language: this.videoValidatorsService.VIDEO_LANGUAGE, | 98 | language: this.videoValidatorsService.VIDEO_LANGUAGE, |
95 | description: this.videoValidatorsService.VIDEO_DESCRIPTION, | 99 | description: this.videoValidatorsService.VIDEO_DESCRIPTION, |
96 | tags: null, | 100 | tags: this.videoValidatorsService.VIDEO_TAGS_ARRAY, |
97 | previewfile: null, | 101 | previewfile: null, |
98 | support: this.videoValidatorsService.VIDEO_SUPPORT, | 102 | support: this.videoValidatorsService.VIDEO_SUPPORT, |
99 | schedulePublicationAt: this.videoValidatorsService.VIDEO_SCHEDULE_PUBLICATION_AT, | 103 | schedulePublicationAt: this.videoValidatorsService.VIDEO_SCHEDULE_PUBLICATION_AT, |
@@ -126,11 +130,29 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
126 | .subscribe(res => this.videoCategories = res) | 130 | .subscribe(res => this.videoCategories = res) |
127 | this.serverService.getVideoLicences() | 131 | this.serverService.getVideoLicences() |
128 | .subscribe(res => this.videoLicences = res) | 132 | .subscribe(res => this.videoLicences = res) |
129 | this.serverService.getVideoLanguages() | 133 | forkJoin([ |
130 | .subscribe(res => this.videoLanguages = res) | 134 | this.instanceService.getAbout(), |
135 | this.serverService.getVideoLanguages() | ||
136 | ]).pipe(map(([ about, languages ]) => ({ about, languages }))) | ||
137 | .subscribe(res => { | ||
138 | this.videoLanguages = res.languages | ||
139 | .map(l => res.about.instance.languages.includes(l.id) | ||
140 | ? { ...l, group: this.i18n('Instance languages'), groupOrder: 0 } | ||
141 | : { ...l, group: this.i18n('All languages'), groupOrder: 1 }) | ||
142 | .sort((a, b) => a.groupOrder - b.groupOrder) | ||
143 | }) | ||
131 | 144 | ||
132 | this.serverService.getVideoPrivacies() | 145 | this.serverService.getVideoPrivacies() |
133 | .subscribe(privacies => this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies)) | 146 | .subscribe(privacies => { |
147 | this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies) | ||
148 | if (this.schedulePublicationPossible) { | ||
149 | this.videoPrivacies.push({ | ||
150 | id: this.SPECIAL_SCHEDULED_PRIVACY, | ||
151 | label: this.i18n('Scheduled'), | ||
152 | description: this.i18n('Hide the video until a specific date') | ||
153 | }) | ||
154 | } | ||
155 | }) | ||
134 | 156 | ||
135 | this.serverConfig = this.serverService.getTmpConfig() | 157 | this.serverConfig = this.serverService.getTmpConfig() |
136 | this.serverService.getConfig() | 158 | this.serverService.getConfig() |