From f8b4a71d428703811fa74dd811ef715c7d7afff6 Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Fri, 8 Jul 2022 10:50:10 +0200 Subject: hooks filter:api.my-lib.playlist-elems.get.* (#5098) * hooks filter:api.my-lib.playlist-elems.get.* closes #4776 * Introduce my-library plugin scope Co-authored-by: Chocobozzz --- .../my-video-playlist-elements.component.ts | 11 +++++++++-- client/src/root-helpers/plugins-manager.ts | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'client') diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts b/client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts index 8fba423c3..c9739b6cc 100644 --- a/client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts +++ b/client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts @@ -2,7 +2,7 @@ import { Subject, Subscription } from 'rxjs' import { CdkDragDrop } from '@angular/cdk/drag-drop' import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { ComponentPagination, ConfirmService, Notifier, ScreenService } from '@app/core' +import { ComponentPagination, ConfirmService, HooksService, Notifier, ScreenService } from '@app/core' import { DropdownAction } from '@app/shared/shared-main' import { VideoShareComponent } from '@app/shared/shared-share-modal' import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist' @@ -32,6 +32,7 @@ export class MyVideoPlaylistElementsComponent implements OnInit, OnDestroy { private paramsSub: Subscription constructor ( + private hooks: HooksService, private notifier: Notifier, private router: Router, private confirmService: ConfirmService, @@ -155,7 +156,13 @@ export class MyVideoPlaylistElementsComponent implements OnInit, OnDestroy { } private loadElements () { - this.videoPlaylistService.getPlaylistVideos({ videoPlaylistId: this.videoPlaylistId, componentPagination: this.pagination }) + this.hooks.wrapObsFun( + this.videoPlaylistService.getPlaylistVideos.bind(this.videoPlaylistService), + { videoPlaylistId: this.videoPlaylistId, componentPagination: this.pagination }, + 'my-library', + 'filter:api.my-library.video-playlist-elements.list.params', + 'filter:api.my-library.video-playlist-elements.list.result' + ) .subscribe(({ total, data }) => { this.playlistElements = this.playlistElements.concat(data) this.pagination.totalItems = total diff --git a/client/src/root-helpers/plugins-manager.ts b/client/src/root-helpers/plugins-manager.ts index 61731032a..49a19781b 100644 --- a/client/src/root-helpers/plugins-manager.ts +++ b/client/src/root-helpers/plugins-manager.ts @@ -67,7 +67,8 @@ class PluginsManager { signup: new ReplaySubject(1), login: new ReplaySubject(1), 'video-edit': new ReplaySubject(1), - embed: new ReplaySubject(1) + embed: new ReplaySubject(1), + 'my-library': new ReplaySubject(1) } private readonly peertubeHelpersFactory: PeertubeHelpersFactory -- cgit v1.2.3