aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/header
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/header')
-rw-r--r--client/src/app/header/header.component.html2
-rw-r--r--client/src/app/header/header.component.ts31
2 files changed, 2 insertions, 31 deletions
diff --git a/client/src/app/header/header.component.html b/client/src/app/header/header.component.html
index 1bdfe9858..4fd18f9bd 100644
--- a/client/src/app/header/header.component.html
+++ b/client/src/app/header/header.component.html
@@ -4,7 +4,7 @@
4> 4>
5<span (click)="doSearch()" class="icon icon-search"></span> 5<span (click)="doSearch()" class="icon icon-search"></span>
6 6
7<a class="upload-button" [routerLink]="routerLink"> 7<a class="upload-button" routerLink="/videos/upload">
8 <my-global-icon iconName="upload"></my-global-icon> 8 <my-global-icon iconName="upload"></my-global-icon>
9 <span i18n class="upload-button-label">Upload</span> 9 <span i18n class="upload-button-label">Upload</span>
10</a> 10</a>
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'
2import { Component, OnInit } from '@angular/core' 2import { Component, OnInit } from '@angular/core'
3import { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router' 3import { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router'
4import { getParameterByName } from '../shared/misc/utils' 4import { getParameterByName } from '../shared/misc/utils'
5import { AuthService, ServerService, Notifier } from '@app/core' 5import { AuthService, Notifier, ServerService } from '@app/core'
6import { of } from 'rxjs' 6import { of } from 'rxjs'
7import { ServerConfig } from '@shared/models'
8import { I18n } from '@ngx-translate/i18n-polyfill' 7import { 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