Reinstate routerLink property of upload button

pull/2400/head
Rigel Kent 2020-01-10 15:52:25 +01:00
parent f24c8b142d
commit 333952bc64
No known key found for this signature in database
GPG Key ID: 5E53E96A494E452F
2 changed files with 11 additions and 11 deletions

View File

@ -4,7 +4,7 @@
>
<span (click)="doSearch()" class="icon icon-search"></span>
<a class="upload-button" (click)="goToUpload()">
<a class="upload-button" [routerLink]="routerLink">
<my-global-icon iconName="upload"></my-global-icon>
<span i18n class="upload-button-label">Upload</span>
</a>

View File

@ -42,6 +42,16 @@ export class HeaderComponent implements OnInit {
)
}
get routerLink () {
if (this.isUserLoggedIn()) {
return [ '/videos/upload' ]
} else if (this.isRegistrationAllowed()) {
return [ '/signup' ]
} else {
return [ '/login', { fromUpload: true } ]
}
}
doSearch () {
const queryParams: Params = {}
@ -67,16 +77,6 @@ export class HeaderComponent implements OnInit {
this.serverConfig.signup.allowedForCurrentIP
}
goToUpload () {
if (this.isUserLoggedIn()) {
this.router.navigate([ '/videos/upload' ])
} else if (this.isRegistrationAllowed()) {
this.router.navigate([ '/signup' ])
} else {
this.router.navigate([ '/login', { fromUpload: true } ])
}
}
private loadUserLanguagesIfNeeded (queryParams: any) {
if (queryParams && queryParams.languageOneOf) return of(queryParams)