]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+accounts/account-search/account-search.component.ts
Merge branch 'release/3.1.0' into develop
[github/Chocobozzz/PeerTube.git] / client / src / app / +accounts / account-search / account-search.component.ts
index 378aa78c45b092d43729c87b41f7640fd40ebfb5..f54ab846a5a39a2335b54b6a259684c95809b692 100644 (file)
@@ -1,4 +1,4 @@
-import { Subscription } from 'rxjs'
+import { forkJoin, Subscription } from 'rxjs'
 import { first, tap } from 'rxjs/operators'
 import { Component, ComponentFactoryResolver, OnDestroy, OnInit } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
@@ -16,6 +16,7 @@ import { VideoFilter } from '@shared/models'
 export class AccountSearchComponent extends AbstractVideoList implements OnInit, OnDestroy {
   titlePage: string
   loadOnInit = false
+  loadUserVideoPreferences = true
 
   search = ''
   filter: VideoFilter = null
@@ -46,14 +47,14 @@ export class AccountSearchComponent extends AbstractVideoList implements OnInit,
     this.enableAllFilterIfPossible()
 
     // Parent get the account for us
-    this.accountSub = this.accountService.accountLoaded
-                          .pipe(first())
-                          .subscribe(account => {
-                            this.account = account
-
-                            this.reloadVideos()
-                            this.generateSyndicationList()
-                          })
+    this.accountSub = forkJoin([
+      this.accountService.accountLoaded.pipe(first()),
+      this.onUserLoadedSubject.pipe(first())
+    ]).subscribe(([ account ]) => {
+      this.account = account
+
+      this.reloadVideos()
+    })
   }
 
   ngOnDestroy () {
@@ -63,9 +64,14 @@ export class AccountSearchComponent extends AbstractVideoList implements OnInit,
   }
 
   updateSearch (value: string) {
-    if (value === '') this.router.navigate(['../videos'], { relativeTo: this.route })
     this.search = value
 
+    if (!this.search) {
+      this.router.navigate([ '../videos' ], { relativeTo: this.route })
+      return
+    }
+
+    this.videos = []
     this.reloadVideos()
   }