diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-04 13:31:41 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-04 15:45:44 +0200 |
commit | 2989628b7913383b39ac34c7db8666a21f8e5037 (patch) | |
tree | ac7759177c04e524e7845143fd685aefb49e810e /client/src/app/header | |
parent | 8e08d415f9473b6b72fef698729453e726da16e7 (diff) | |
download | PeerTube-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.ts | 22 |
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 @@ | |||
1 | import { of } from 'rxjs' | 1 | import { of } from 'rxjs' |
2 | import { first, tap } from 'rxjs/operators' | 2 | import { first, tap } from 'rxjs/operators' |
3 | import { ListKeyManager } from '@angular/cdk/a11y' | 3 | import { ListKeyManager } from '@angular/cdk/a11y' |
4 | import { AfterViewChecked, AfterViewInit, Component, OnDestroy, OnInit, QueryList, ViewChildren } from '@angular/core' | 4 | import { AfterViewChecked, Component, OnDestroy, OnInit, QueryList, ViewChildren } from '@angular/core' |
5 | import { ActivatedRoute, Params, Router } from '@angular/router' | 5 | import { ActivatedRoute, Params, Router } from '@angular/router' |
6 | import { AuthService, ServerService } from '@app/core' | 6 | import { AuthService, ServerService } from '@app/core' |
7 | import { SearchTargetType, ServerConfig } from '@shared/models' | 7 | import { HTMLServerConfig, SearchTargetType } from '@shared/models' |
8 | import { SuggestionComponent, SuggestionPayload, SuggestionPayloadType } from './suggestion.component' | 8 | import { 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 | }) |
15 | export class SearchTypeaheadComponent implements OnInit, AfterViewInit, AfterViewChecked, OnDestroy { | 15 | export 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 | ||