import { LoadingBarService } from '@ngx-loading-bar/core'
import { NotificationsService } from 'angular2-notifications'
import { BytesPipe } from 'ngx-pipes'
-import { Subscription } from 'rxjs/Subscription'
+import { Subscription } from 'rxjs'
import { VideoPrivacy } from '../../../../../shared/models/videos'
import { AuthService, ServerService } from '../../core'
import { FormReactive } from '../../shared'
'./video-add.component.scss'
]
})
-
export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy, CanComponentDeactivate {
@ViewChild('videofileInput') videofileInput
formErrors: { [ id: string ]: string } = {}
validationMessages: ValidatorMessage = {}
- userVideoChannels = []
+ userVideoChannels: { id: number, label: string, support: string }[] = []
userVideoQuotaUsed = 0
videoPrivacies = []
firstStepPrivacyId = 0
this.videoFileName = videofile.name
- const name = videofile.name.replace(/\.[^/.]+$/, '')
+ const nameWithoutExtension = videofile.name.replace(/\.[^/.]+$/, '')
+ let name: string
+
+ // If the name of the file is very small, keep the extension
+ if (nameWithoutExtension.length < 3) {
+ name = videofile.name
+ } else {
+ name = nameWithoutExtension
+ }
+
const privacy = this.firstStepPrivacyId.toString()
const nsfw = false
const commentsEnabled = true
const video = new VideoEdit()
video.patch(this.form.value)
- video.channel = this.firstStepChannelId
video.id = this.videoUploadedIds.id
video.uuid = this.videoUploadedIds.uuid