aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/header
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-04 13:31:41 +0200
committerChocobozzz <me@florianbigard.com>2021-06-04 15:45:44 +0200
commit2989628b7913383b39ac34c7db8666a21f8e5037 (patch)
treeac7759177c04e524e7845143fd685aefb49e810e /client/src/app/header
parent8e08d415f9473b6b72fef698729453e726da16e7 (diff)
downloadPeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.tar.gz
PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.tar.zst
PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.zip
Use HTML config when possible
Diffstat (limited to 'client/src/app/header')
-rw-r--r--client/src/app/header/search-typeahead.component.ts22
1 files changed, 8 insertions, 14 deletions
diff --git a/client/src/app/header/search-typeahead.component.ts b/client/src/app/header/search-typeahead.component.ts
index c546628ee..b5d76c70e 100644
--- a/client/src/app/header/search-typeahead.component.ts
+++ b/client/src/app/header/search-typeahead.component.ts
@@ -1,10 +1,10 @@
1import { of } from 'rxjs' 1import { of } from 'rxjs'
2import { first, tap } from 'rxjs/operators' 2import { first, tap } from 'rxjs/operators'
3import { ListKeyManager } from '@angular/cdk/a11y' 3import { ListKeyManager } from '@angular/cdk/a11y'
4import { AfterViewChecked, AfterViewInit, Component, OnDestroy, OnInit, QueryList, ViewChildren } from '@angular/core' 4import { AfterViewChecked, Component, OnDestroy, OnInit, QueryList, ViewChildren } from '@angular/core'
5import { ActivatedRoute, Params, Router } from '@angular/router' 5import { ActivatedRoute, Params, Router } from '@angular/router'
6import { AuthService, ServerService } from '@app/core' 6import { AuthService, ServerService } from '@app/core'
7import { SearchTargetType, ServerConfig } from '@shared/models' 7import { HTMLServerConfig, SearchTargetType } from '@shared/models'
8import { SuggestionComponent, SuggestionPayload, SuggestionPayloadType } from './suggestion.component' 8import { SuggestionComponent, SuggestionPayload, SuggestionPayloadType } from './suggestion.component'
9 9
10@Component({ 10@Component({
@@ -12,7 +12,7 @@ import { SuggestionComponent, SuggestionPayload, SuggestionPayloadType } from '.
12 templateUrl: './search-typeahead.component.html', 12 templateUrl: './search-typeahead.component.html',
13 styleUrls: [ './search-typeahead.component.scss' ] 13 styleUrls: [ './search-typeahead.component.scss' ]
14}) 14})
15export class SearchTypeaheadComponent implements OnInit, AfterViewInit, AfterViewChecked, OnDestroy { 15export class SearchTypeaheadComponent implements OnInit, AfterViewChecked, OnDestroy {
16 @ViewChildren(SuggestionComponent) suggestionItems: QueryList<SuggestionComponent> 16 @ViewChildren(SuggestionComponent) suggestionItems: QueryList<SuggestionComponent>
17 17
18 hasChannel = false 18 hasChannel = false
@@ -20,7 +20,7 @@ export class SearchTypeaheadComponent implements OnInit, AfterViewInit, AfterVie
20 areSuggestionsOpened = true 20 areSuggestionsOpened = true
21 21
22 search = '' 22 search = ''
23 serverConfig: ServerConfig 23 serverConfig: HTMLServerConfig
24 24
25 inThisChannelText: string 25 inThisChannelText: string
26 26
@@ -42,20 +42,14 @@ export class SearchTypeaheadComponent implements OnInit, AfterViewInit, AfterVie
42 this.route.queryParams 42 this.route.queryParams
43 .pipe(first(params => this.isOnSearch() && params.search !== undefined && params.search !== null)) 43 .pipe(first(params => this.isOnSearch() && params.search !== undefined && params.search !== null))
44 .subscribe(params => this.search = params.search) 44 .subscribe(params => this.search = params.search)
45 }
46 45
47 ngAfterViewInit () { 46 this.serverConfig = this.serverService.getHTMLConfig()
48 this.serverService.getConfig() 47 this.computeTypeahead()
48
49 this.serverService.configReloaded
49 .subscribe(config => { 50 .subscribe(config => {
50 this.serverConfig = config 51 this.serverConfig = config
51
52 this.computeTypeahead() 52 this.computeTypeahead()
53
54 this.serverService.configReloaded
55 .subscribe(config => {
56 this.serverConfig = config
57 this.computeTypeahead()
58 })
59 }) 53 })
60 } 54 }
61 55