aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/header/header.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-01-21 10:52:22 +0100
committerChocobozzz <me@florianbigard.com>2020-01-21 11:03:46 +0100
commit21e6dc811d18637dbadb31c724420361913dbc29 (patch)
tree3b45186eef0fc21779873607712ec68483db17d1 /client/src/app/header/header.component.ts
parent4ee6a8b13edb0dd6186139f3a6589b06139f464b (diff)
downloadPeerTube-21e6dc811d18637dbadb31c724420361913dbc29.tar.gz
PeerTube-21e6dc811d18637dbadb31c724420361913dbc29.tar.zst
PeerTube-21e6dc811d18637dbadb31c724420361913dbc29.zip
Cleanup login form
Diffstat (limited to 'client/src/app/header/header.component.ts')
-rw-r--r--client/src/app/header/header.component.ts31
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'
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