X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fvideos%2F%2Bvideo-edit%2Fvideo-add.component.ts;h=92b03e8c96cae9c6898aa871929a3e139ef38f0d;hb=8bf89b095a711d5ac5e6ef55575b166257d0d526;hp=21311b184067add1af455b3bc7228b5f346e240d;hpb=a685e25ca05f08ad1b3f7fbaccc8744727bd8d27;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.ts index 21311b184..92b03e8c9 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts @@ -11,12 +11,14 @@ import { VIDEO_LICENCE, VIDEO_LANGUAGE, VIDEO_DESCRIPTION, - VIDEO_TAGS + VIDEO_TAGS, + VIDEO_CHANNEL, + VIDEO_FILE } from '../../shared' +import { AuthService, ServerService } from '../../core' import { VideoService } from '../shared' import { VideoCreate } from '../../../../../shared' import { HttpEventType, HttpResponse } from '@angular/common/http' -import { VIDEO_FILE } from '../../shared/forms/form-validators/video' @Component({ selector: 'my-videos-add', @@ -32,6 +34,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { videoCategories = [] videoLicences = [] videoLanguages = [] + userVideoChannels = [] tagValidators = VIDEO_TAGS.VALIDATORS tagValidatorsMessages = VIDEO_TAGS.MESSAGES @@ -43,6 +46,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { category: '', licence: '', language: '', + channelId: '', description: '', videofile: '' } @@ -51,6 +55,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { category: VIDEO_CATEGORY.MESSAGES, licence: VIDEO_LICENCE.MESSAGES, language: VIDEO_LANGUAGE.MESSAGES, + channelId: VIDEO_CHANNEL.MESSAGES, description: VIDEO_DESCRIPTION.MESSAGES, videofile: VIDEO_FILE.MESSAGES } @@ -59,6 +64,8 @@ export class VideoAddComponent extends FormReactive implements OnInit { private formBuilder: FormBuilder, private router: Router, private notificationsService: NotificationsService, + private authService: AuthService, + private serverService: ServerService, private videoService: VideoService ) { super() @@ -75,6 +82,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { category: [ '', VIDEO_CATEGORY.VALIDATORS ], licence: [ '', VIDEO_LICENCE.VALIDATORS ], language: [ '', VIDEO_LANGUAGE.VALIDATORS ], + channelId: [ this.userVideoChannels[0].id, VIDEO_CHANNEL.VALIDATORS ], description: [ '', VIDEO_DESCRIPTION.VALIDATORS ], videofile: [ '', VIDEO_FILE.VALIDATORS ], tags: [ '' ] @@ -84,9 +92,12 @@ export class VideoAddComponent extends FormReactive implements OnInit { } ngOnInit () { - this.videoCategories = this.videoService.videoCategories - this.videoLicences = this.videoService.videoLicences - this.videoLanguages = this.videoService.videoLanguages + this.videoCategories = this.serverService.getVideoCategories() + this.videoLicences = this.serverService.getVideoLicences() + this.videoLanguages = this.serverService.getVideoLanguages() + + const user = this.authService.getUser() + this.userVideoChannels = user.videoChannels.map(v => ({ id: v.id, label: v.name })) this.buildForm() } @@ -120,6 +131,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { const category = formValue.category const licence = formValue.licence const language = formValue.language + const channelId = formValue.channelId const description = formValue.description const tags = formValue.tags const videofile = this.videofileInput.nativeElement.files[0] @@ -129,6 +141,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { formData.append('category', '' + category) formData.append('nsfw', '' + nsfw) formData.append('licence', '' + licence) + formData.append('channelId', '' + channelId) formData.append('videofile', videofile) // Language is optional