Fix /:@actor redirection

Fixes https://github.com/Chocobozzz/PeerTube/issues/4134
pull/4141/head
Chocobozzz 2021-05-31 14:44:38 +02:00
parent 8ee25e17b8
commit 698a8c6508
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 3 additions and 8 deletions

View File

@ -22,20 +22,15 @@ export class ActorRedirectGuard implements CanActivate {
this.channelService.getVideoChannel(actorName).pipe(this.orUndefined())
]).pipe(
map(([ account, channel ]) => {
if (!account && !channel) {
this.router.navigate([ '/404' ])
return false
}
if (account) {
this.router.navigate([ `/a/${actorName}` ], { skipLocationChange: true })
return this.router.parseUrl(`/a/${actorName}`)
}
if (channel) {
this.router.navigate([ `/c/${actorName}` ], { skipLocationChange: true })
return this.router.parseUrl(`/c/${actorName}`)
}
return true
return this.router.parseUrl('/404')
})
)
}