aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/header/search-typeahead.component.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-04-19 23:41:05 +0200
committerRigel Kent <par@rigelk.eu>2020-05-01 16:41:02 +0200
commit36004aa7b0de5cb69a452090770221b192a78eb8 (patch)
treee47af3699c686244891659fa2a86b8f3554de197 /client/src/app/header/search-typeahead.component.ts
parent042daa7072c0168b876db2badfc838dba7ac2284 (diff)
downloadPeerTube-36004aa7b0de5cb69a452090770221b192a78eb8.tar.gz
PeerTube-36004aa7b0de5cb69a452090770221b192a78eb8.tar.zst
PeerTube-36004aa7b0de5cb69a452090770221b192a78eb8.zip
Support search param in URL for video abuses
Diffstat (limited to 'client/src/app/header/search-typeahead.component.ts')
-rw-r--r--client/src/app/header/search-typeahead.component.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/client/src/app/header/search-typeahead.component.ts b/client/src/app/header/search-typeahead.component.ts
index d0350368d..2bf1072f4 100644
--- a/client/src/app/header/search-typeahead.component.ts
+++ b/client/src/app/header/search-typeahead.component.ts
@@ -36,7 +36,7 @@ export class SearchTypeaheadComponent implements OnInit, OnDestroy {
36 36
37 ngOnInit () { 37 ngOnInit () {
38 this.route.queryParams 38 this.route.queryParams
39 .pipe(first(params => params.search !== undefined && params.search !== null)) 39 .pipe(first(params => this.isOnSearch() && params.search !== undefined && params.search !== null))
40 .subscribe(params => this.search = params.search) 40 .subscribe(params => this.search = params.search)
41 this.serverService.getConfig() 41 this.serverService.getConfig()
42 .subscribe(config => this.serverConfig = config) 42 .subscribe(config => this.serverConfig = config)
@@ -146,11 +146,15 @@ export class SearchTypeaheadComponent implements OnInit, OnDestroy {
146 } 146 }
147 } 147 }
148 148
149 isOnSearch () {
150 return window.location.pathname === '/search'
151 }
152
149 doSearch () { 153 doSearch () {
150 this.newSearch = false 154 this.newSearch = false
151 const queryParams: Params = {} 155 const queryParams: Params = {}
152 156
153 if (window.location.pathname === '/search' && this.route.snapshot.queryParams) { 157 if (this.isOnSearch() && this.route.snapshot.queryParams) {
154 Object.assign(queryParams, this.route.snapshot.queryParams) 158 Object.assign(queryParams, this.route.snapshot.queryParams)
155 } 159 }
156 160