diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-01-10 15:52:25 +0100 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2020-01-10 15:52:25 +0100 |
commit | 333952bc6478358ef6979b35d8dc215283b4717e (patch) | |
tree | 33923cfe74ae19b3f7102c301fe2372abfda06f8 /client/src/app/header | |
parent | f24c8b142d89e4a9ce40da9faed889c1985b53cc (diff) | |
download | PeerTube-333952bc6478358ef6979b35d8dc215283b4717e.tar.gz PeerTube-333952bc6478358ef6979b35d8dc215283b4717e.tar.zst PeerTube-333952bc6478358ef6979b35d8dc215283b4717e.zip |
Reinstate routerLink property of upload button
Diffstat (limited to 'client/src/app/header')
-rw-r--r-- | client/src/app/header/header.component.html | 2 | ||||
-rw-r--r-- | client/src/app/header/header.component.ts | 20 |
2 files changed, 11 insertions, 11 deletions
diff --git a/client/src/app/header/header.component.html b/client/src/app/header/header.component.html index 4b3d5e105..599861817 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" (click)="goToUpload()"> | 7 | <a class="upload-button" [routerLink]="routerLink"> |
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 192d6945b..580535669 100644 --- a/client/src/app/header/header.component.ts +++ b/client/src/app/header/header.component.ts | |||
@@ -42,6 +42,16 @@ export class HeaderComponent implements OnInit { | |||
42 | ) | 42 | ) |
43 | } | 43 | } |
44 | 44 | ||
45 | get routerLink () { | ||
46 | if (this.isUserLoggedIn()) { | ||
47 | return [ '/videos/upload' ] | ||
48 | } else if (this.isRegistrationAllowed()) { | ||
49 | return [ '/signup' ] | ||
50 | } else { | ||
51 | return [ '/login', { fromUpload: true } ] | ||
52 | } | ||
53 | } | ||
54 | |||
45 | doSearch () { | 55 | doSearch () { |
46 | const queryParams: Params = {} | 56 | const queryParams: Params = {} |
47 | 57 | ||
@@ -67,16 +77,6 @@ export class HeaderComponent implements OnInit { | |||
67 | this.serverConfig.signup.allowedForCurrentIP | 77 | this.serverConfig.signup.allowedForCurrentIP |
68 | } | 78 | } |
69 | 79 | ||
70 | goToUpload () { | ||
71 | if (this.isUserLoggedIn()) { | ||
72 | this.router.navigate([ '/videos/upload' ]) | ||
73 | } else if (this.isRegistrationAllowed()) { | ||
74 | this.router.navigate([ '/signup' ]) | ||
75 | } else { | ||
76 | this.router.navigate([ '/login', { fromUpload: true } ]) | ||
77 | } | ||
78 | } | ||
79 | |||
80 | private loadUserLanguagesIfNeeded (queryParams: any) { | 80 | private loadUserLanguagesIfNeeded (queryParams: any) { |
81 | if (queryParams && queryParams.languageOneOf) return of(queryParams) | 81 | if (queryParams && queryParams.languageOneOf) return of(queryParams) |
82 | 82 | ||