X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Bvideos%2F%2Bvideo-edit%2Fvideo-add-components%2Fvideo-import-url.component.ts;h=3243b4d3846871aefa4b4e476b7dd43fa5b14833;hb=cf21b2cbef61929177b9c09b5e017c3b7eb8535d;hp=47f59a5d012ca6392eba319d7d50763871f62fc9;hpb=c6c0fa6cd8fe8f752463d8982c3dbcd448739c4e;p=github%2FChocobozzz%2FPeerTube.git 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 47f59a5d0..3243b4d38 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 @@ -1,7 +1,7 @@ import { map, switchMap } from 'rxjs/operators' -import { Component, EventEmitter, OnInit, Output } from '@angular/core' +import { AfterViewInit, Component, EventEmitter, OnInit, Output } from '@angular/core' import { Router } from '@angular/router' -import { AuthService, CanComponentDeactivate, Notifier, ServerService } from '@app/core' +import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService } from '@app/core' import { getAbsoluteAPIUrl, scrollToTop } from '@app/helpers' import { FormValidatorService } from '@app/shared/shared-forms' import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' @@ -18,7 +18,7 @@ import { VideoSend } from './video-send' './video-send.scss' ] }) -export class VideoImportUrlComponent extends VideoSend implements OnInit, CanComponentDeactivate { +export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterViewInit, CanComponentDeactivate { @Output() firstStepDone = new EventEmitter() @Output() firstStepError = new EventEmitter() @@ -31,8 +31,6 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom video: VideoEdit error: string - protected readonly DEFAULT_VIDEO_PRIVACY = VideoPrivacy.PUBLIC - constructor ( protected formValidatorService: FormValidatorService, protected loadingBar: LoadingBarService, @@ -42,8 +40,9 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom protected videoService: VideoService, protected videoCaptionService: VideoCaptionService, private router: Router, - private videoImportService: VideoImportService - ) { + private videoImportService: VideoImportService, + private hooks: HooksService + ) { super() } @@ -51,6 +50,10 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom super.ngOnInit() } + ngAfterViewInit () { + this.hooks.runAction('action:video-url-import.init', 'video-edit') + } + canDeactivate () { return { canDeactivate: true } } @@ -63,7 +66,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom this.isImportingVideo = true const videoUpdate: VideoUpdate = { - privacy: this.firstStepPrivacyId, + privacy: this.highestPrivacy, waitTranscoding: false, commentsEnabled: true, downloadEnabled: true, @@ -103,6 +106,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom this.video = new VideoEdit(Object.assign(video, { commentsEnabled: videoUpdate.commentsEnabled, downloadEnabled: videoUpdate.downloadEnabled, + privacy: { id: this.firstStepPrivacyId }, support: null, thumbnailUrl, previewUrl @@ -138,7 +142,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom this.isUpdatingVideo = false this.notifier.success($localize`Video to import updated.`) - this.router.navigate([ '/my-account', 'video-imports' ]) + this.router.navigate([ '/my-library', 'video-imports' ]) }, err => {