From 9ca0f688e9e8558233f1a538b96a43da44e35353 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 3 Aug 2022 10:39:40 +0200 Subject: Add channel hooks --- .../video-channel-create.component.ts | 13 +++++++++---- .../video-channel-update.component.ts | 18 ++++++++++++------ 2 files changed, 21 insertions(+), 10 deletions(-) (limited to 'client/src/app/+manage') diff --git a/client/src/app/+manage/video-channel-edit/video-channel-create.component.ts b/client/src/app/+manage/video-channel-edit/video-channel-create.component.ts index 5f8e0278e..8211451a4 100644 --- a/client/src/app/+manage/video-channel-edit/video-channel-create.component.ts +++ b/client/src/app/+manage/video-channel-edit/video-channel-create.component.ts @@ -1,8 +1,8 @@ import { of } from 'rxjs' import { switchMap } from 'rxjs/operators' -import { Component, OnInit } from '@angular/core' +import { AfterViewInit, Component, OnInit } from '@angular/core' import { Router } from '@angular/router' -import { AuthService, Notifier } from '@app/core' +import { AuthService, HooksService, Notifier } from '@app/core' import { VIDEO_CHANNEL_DESCRIPTION_VALIDATOR, VIDEO_CHANNEL_DISPLAY_NAME_VALIDATOR, @@ -18,7 +18,7 @@ import { VideoChannelEdit } from './video-channel-edit' templateUrl: './video-channel-edit.component.html', styleUrls: [ './video-channel-edit.component.scss' ] }) -export class VideoChannelCreateComponent extends VideoChannelEdit implements OnInit { +export class VideoChannelCreateComponent extends VideoChannelEdit implements OnInit, AfterViewInit { error: string videoChannel = new VideoChannel({}) @@ -30,7 +30,8 @@ export class VideoChannelCreateComponent extends VideoChannelEdit implements OnI private authService: AuthService, private notifier: Notifier, private router: Router, - private videoChannelService: VideoChannelService + private videoChannelService: VideoChannelService, + private hooks: HooksService ) { super() } @@ -44,6 +45,10 @@ export class VideoChannelCreateComponent extends VideoChannelEdit implements OnI }) } + ngAfterViewInit () { + this.hooks.runAction('action:video-channel-create.init', 'video-channel') + } + formValidated () { this.error = undefined diff --git a/client/src/app/+manage/video-channel-edit/video-channel-update.component.ts b/client/src/app/+manage/video-channel-edit/video-channel-update.component.ts index 6b4947912..7e8d6ffe6 100644 --- a/client/src/app/+manage/video-channel-edit/video-channel-update.component.ts +++ b/client/src/app/+manage/video-channel-edit/video-channel-update.component.ts @@ -1,8 +1,8 @@ import { Subscription } from 'rxjs' import { HttpErrorResponse } from '@angular/common/http' -import { Component, OnDestroy, OnInit } from '@angular/core' -import { ActivatedRoute, Router } from '@angular/router' -import { AuthService, Notifier, RedirectService, ServerService } from '@app/core' +import { AfterViewInit, Component, OnDestroy, OnInit } from '@angular/core' +import { ActivatedRoute } from '@angular/router' +import { AuthService, HooksService, Notifier, RedirectService, ServerService } from '@app/core' import { genericUploadErrorHandler } from '@app/helpers' import { VIDEO_CHANNEL_DESCRIPTION_VALIDATOR, @@ -19,7 +19,7 @@ import { VideoChannelEdit } from './video-channel-edit' templateUrl: './video-channel-edit.component.html', styleUrls: [ './video-channel-edit.component.scss' ] }) -export class VideoChannelUpdateComponent extends VideoChannelEdit implements OnInit, OnDestroy { +export class VideoChannelUpdateComponent extends VideoChannelEdit implements OnInit, AfterViewInit, OnDestroy { error: string videoChannel: VideoChannel @@ -31,11 +31,11 @@ export class VideoChannelUpdateComponent extends VideoChannelEdit implements OnI protected formValidatorService: FormValidatorService, private authService: AuthService, private notifier: Notifier, - private router: Router, private route: ActivatedRoute, private videoChannelService: VideoChannelService, private serverService: ServerService, - private redirectService: RedirectService + private redirectService: RedirectService, + private hooks: HooksService ) { super() } @@ -58,6 +58,8 @@ export class VideoChannelUpdateComponent extends VideoChannelEdit implements OnI next: videoChannelToUpdate => { this.videoChannel = videoChannelToUpdate + this.hooks.runAction('action:video-channel-update.video-channel.loaded', 'video-channel', { videoChannel: this.videoChannel }) + this.oldSupportField = videoChannelToUpdate.support this.form.patchValue({ @@ -74,6 +76,10 @@ export class VideoChannelUpdateComponent extends VideoChannelEdit implements OnI }) } + ngAfterViewInit () { + this.hooks.runAction('action:video-channel-update.init', 'video-channel') + } + ngOnDestroy () { if (this.paramsSub) this.paramsSub.unsubscribe() } -- cgit v1.2.3