aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>2022-07-08 10:50:10 +0200
committerGitHub <noreply@github.com>2022-07-08 10:50:10 +0200
commitf8b4a71d428703811fa74dd811ef715c7d7afff6 (patch)
tree2c07b193d79e9ead8d7d98980964e9af671a76cc
parentedd7b1256b8b1352fb9c67e79231b0ab24b8dd40 (diff)
downloadPeerTube-f8b4a71d428703811fa74dd811ef715c7d7afff6.tar.gz
PeerTube-f8b4a71d428703811fa74dd811ef715c7d7afff6.tar.zst
PeerTube-f8b4a71d428703811fa74dd811ef715c7d7afff6.zip
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 <me@florianbigard.com>
-rw-r--r--client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts11
-rw-r--r--client/src/root-helpers/plugins-manager.ts3
-rw-r--r--shared/models/plugins/client/client-hook.model.ts4
-rw-r--r--shared/models/plugins/client/plugin-client-scope.type.ts3
4 files changed, 17 insertions, 4 deletions
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'
2import { CdkDragDrop } from '@angular/cdk/drag-drop' 2import { CdkDragDrop } from '@angular/cdk/drag-drop'
3import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core' 3import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'
4import { ActivatedRoute, Router } from '@angular/router' 4import { ActivatedRoute, Router } from '@angular/router'
5import { ComponentPagination, ConfirmService, Notifier, ScreenService } from '@app/core' 5import { ComponentPagination, ConfirmService, HooksService, Notifier, ScreenService } from '@app/core'
6import { DropdownAction } from '@app/shared/shared-main' 6import { DropdownAction } from '@app/shared/shared-main'
7import { VideoShareComponent } from '@app/shared/shared-share-modal' 7import { VideoShareComponent } from '@app/shared/shared-share-modal'
8import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist' 8import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist'
@@ -32,6 +32,7 @@ export class MyVideoPlaylistElementsComponent implements OnInit, OnDestroy {
32 private paramsSub: Subscription 32 private paramsSub: Subscription
33 33
34 constructor ( 34 constructor (
35 private hooks: HooksService,
35 private notifier: Notifier, 36 private notifier: Notifier,
36 private router: Router, 37 private router: Router,
37 private confirmService: ConfirmService, 38 private confirmService: ConfirmService,
@@ -155,7 +156,13 @@ export class MyVideoPlaylistElementsComponent implements OnInit, OnDestroy {
155 } 156 }
156 157
157 private loadElements () { 158 private loadElements () {
158 this.videoPlaylistService.getPlaylistVideos({ videoPlaylistId: this.videoPlaylistId, componentPagination: this.pagination }) 159 this.hooks.wrapObsFun(
160 this.videoPlaylistService.getPlaylistVideos.bind(this.videoPlaylistService),
161 { videoPlaylistId: this.videoPlaylistId, componentPagination: this.pagination },
162 'my-library',
163 'filter:api.my-library.video-playlist-elements.list.params',
164 'filter:api.my-library.video-playlist-elements.list.result'
165 )
159 .subscribe(({ total, data }) => { 166 .subscribe(({ total, data }) => {
160 this.playlistElements = this.playlistElements.concat(data) 167 this.playlistElements = this.playlistElements.concat(data)
161 this.pagination.totalItems = total 168 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 {
67 signup: new ReplaySubject<boolean>(1), 67 signup: new ReplaySubject<boolean>(1),
68 login: new ReplaySubject<boolean>(1), 68 login: new ReplaySubject<boolean>(1),
69 'video-edit': new ReplaySubject<boolean>(1), 69 'video-edit': new ReplaySubject<boolean>(1),
70 embed: new ReplaySubject<boolean>(1) 70 embed: new ReplaySubject<boolean>(1),
71 'my-library': new ReplaySubject<boolean>(1)
71 } 72 }
72 73
73 private readonly peertubeHelpersFactory: PeertubeHelpersFactory 74 private readonly peertubeHelpersFactory: PeertubeHelpersFactory
diff --git a/shared/models/plugins/client/client-hook.model.ts b/shared/models/plugins/client/client-hook.model.ts
index 04d42d591..466be8946 100644
--- a/shared/models/plugins/client/client-hook.model.ts
+++ b/shared/models/plugins/client/client-hook.model.ts
@@ -51,6 +51,10 @@ export const clientFilterHookObject = {
51 // Filter form 51 // Filter form
52 'filter:api.signup.registration.create.params': true, 52 'filter:api.signup.registration.create.params': true,
53 53
54 // Filter params/result of the function that fetch video playlist elements of the my-library page
55 'filter:api.my-library.video-playlist-elements.list.params': true,
56 'filter:api.my-library.video-playlist-elements.list.result': true,
57
54 // Filter the options to create our player 58 // Filter the options to create our player
55 'filter:internal.video-watch.player.build-options.params': true, 59 'filter:internal.video-watch.player.build-options.params': true,
56 'filter:internal.video-watch.player.build-options.result': true, 60 'filter:internal.video-watch.player.build-options.result': true,
diff --git a/shared/models/plugins/client/plugin-client-scope.type.ts b/shared/models/plugins/client/plugin-client-scope.type.ts
index 8cc234ff2..92734533d 100644
--- a/shared/models/plugins/client/plugin-client-scope.type.ts
+++ b/shared/models/plugins/client/plugin-client-scope.type.ts
@@ -6,4 +6,5 @@ export type PluginClientScope =
6 'login' | 6 'login' |
7 'embed' | 7 'embed' |
8 'video-edit' | 8 'video-edit' |
9 'admin-plugin' 9 'admin-plugin' |
10 'my-library'