diff options
Diffstat (limited to 'client/src/app/header/header.component.ts')
-rw-r--r-- | client/src/app/header/header.component.ts | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/client/src/app/header/header.component.ts b/client/src/app/header/header.component.ts index 5fd122930..92a7eded6 100644 --- a/client/src/app/header/header.component.ts +++ b/client/src/app/header/header.component.ts | |||
@@ -2,9 +2,8 @@ import { filter, first, map, tap } from 'rxjs/operators' | |||
2 | import { Component, OnInit } from '@angular/core' | 2 | import { Component, OnInit } from '@angular/core' |
3 | import { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router' | 3 | import { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router' |
4 | import { getParameterByName } from '../shared/misc/utils' | 4 | import { getParameterByName } from '../shared/misc/utils' |
5 | import { AuthService, ServerService, Notifier } from '@app/core' | 5 | import { AuthService, Notifier, ServerService } from '@app/core' |
6 | import { of } from 'rxjs' | 6 | import { of } from 'rxjs' |
7 | import { ServerConfig } from '@shared/models' | ||
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | 7 | import { I18n } from '@ngx-translate/i18n-polyfill' |
9 | 8 | ||
10 | @Component({ | 9 | @Component({ |
@@ -17,8 +16,6 @@ export class HeaderComponent implements OnInit { | |||
17 | searchValue = '' | 16 | searchValue = '' |
18 | ariaLabelTextForSearch = '' | 17 | ariaLabelTextForSearch = '' |
19 | 18 | ||
20 | private serverConfig: ServerConfig | ||
21 | |||
22 | constructor ( | 19 | constructor ( |
23 | private router: Router, | 20 | private router: Router, |
24 | private route: ActivatedRoute, | 21 | private route: ActivatedRoute, |
@@ -38,23 +35,6 @@ export class HeaderComponent implements OnInit { | |||
38 | map(() => getParameterByName('search', window.location.href)) | 35 | map(() => getParameterByName('search', window.location.href)) |
39 | ) | 36 | ) |
40 | .subscribe(searchQuery => this.searchValue = searchQuery || '') | 37 | .subscribe(searchQuery => this.searchValue = searchQuery || '') |
41 | |||
42 | this.serverConfig = this.serverService.getTmpConfig() | ||
43 | this.serverService.getConfig().subscribe( | ||
44 | config => this.serverConfig = config, | ||
45 | |||
46 | err => this.notifier.error(err.message) | ||
47 | ) | ||
48 | } | ||
49 | |||
50 | get routerLink () { | ||
51 | if (this.isUserLoggedIn()) { | ||
52 | return [ '/videos/upload' ] | ||
53 | } else if (this.isRegistrationAllowed()) { | ||
54 | return [ '/signup' ] | ||
55 | } else { | ||
56 | return [ '/login', { fromUpload: true } ] | ||
57 | } | ||
58 | } | 38 | } |
59 | 39 | ||
60 | doSearch () { | 40 | doSearch () { |
@@ -73,15 +53,6 @@ export class HeaderComponent implements OnInit { | |||
73 | o.subscribe(() => this.router.navigate([ '/search' ], { queryParams })) | 53 | o.subscribe(() => this.router.navigate([ '/search' ], { queryParams })) |
74 | } | 54 | } |
75 | 55 | ||
76 | isUserLoggedIn () { | ||
77 | return this.authService.isLoggedIn() | ||
78 | } | ||
79 | |||
80 | isRegistrationAllowed () { | ||
81 | return this.serverConfig.signup.allowed && | ||
82 | this.serverConfig.signup.allowedForCurrentIP | ||
83 | } | ||
84 | |||
85 | private loadUserLanguagesIfNeeded (queryParams: any) { | 56 | private loadUserLanguagesIfNeeded (queryParams: any) { |
86 | if (queryParams && queryParams.languageOneOf) return of(queryParams) | 57 | if (queryParams && queryParams.languageOneOf) return of(queryParams) |
87 | 58 | ||