1
0
Fork 0

Reinstate routerLink property of upload button

This commit is contained in:
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)