]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/core/plugins/plugin.service.ts
Add notifier to plugin helpers (#2627)
[github/Chocobozzz/PeerTube.git] / client / src / app / core / plugins / plugin.service.ts
index 3f96ef6de72bf79ca147ccc4429aacd9752c6219..b9d55a7e49ef7fb3c5bd4786f3d2547030c298ba 100644 (file)
@@ -12,7 +12,7 @@ import { ClientHook, ClientHookName, clientHookObject } from '@shared/models/plu
 import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type'
 import { RegisterClientHookOptions } from '@shared/models/plugins/register-client-hook.model'
 import { HttpClient } from '@angular/common/http'
-import { AuthService } from '@app/core'
+import { AuthService, Notifier } from '@app/core'
 import { RestExtractor } from '@app/shared/rest'
 import { PluginType } from '@shared/models/plugins/plugin.type'
 import { PublicServerSetting } from '@shared/models/plugins/public-server.setting'
@@ -60,6 +60,7 @@ export class PluginService implements ClientHook {
   constructor (
     private router: Router,
     private authService: AuthService,
+    private notifier: Notifier,
     private server: ServerService,
     private zone: NgZone,
     private authHttp: HttpClient,
@@ -70,9 +71,9 @@ export class PluginService implements ClientHook {
   }
 
   initializePlugins () {
-    this.server.configLoaded
-      .subscribe(() => {
-        this.plugins = this.server.getConfig().plugin.registered
+    this.server.getConfig()
+      .subscribe(config => {
+        this.plugins = config.plugin.registered
 
         this.buildScopeStruct()
 
@@ -272,6 +273,8 @@ export class PluginService implements ClientHook {
         return this.authService.isLoggedIn()
       },
 
+      notifier: this.notifier,
+
       translate: (value: string) => {
         return this.translationsObservable
             .pipe(map(allTranslations => allTranslations[npmName]))