aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/root.component.ts
diff options
context:
space:
mode:
authorKimsible <kimsible@users.noreply.github.com>2021-05-03 19:03:08 +0200
committerKimsible <kimsible@users.noreply.github.com>2021-05-05 11:48:25 +0200
commit030ccfce59a8cb8f2fee6ea8dd363ba635c5c5c2 (patch)
tree447ad863f826f964bcaf9405a5002b45b538c27d /client/src/app/root.component.ts
parent718873964490d1aa31b0e99852002165637e4b9e (diff)
downloadPeerTube-030ccfce59a8cb8f2fee6ea8dd363ba635c5c5c2.tar.gz
PeerTube-030ccfce59a8cb8f2fee6ea8dd363ba635c5c5c2.tar.zst
PeerTube-030ccfce59a8cb8f2fee6ea8dd363ba635c5c5c2.zip
Use userId key to distinct Account or VideoChannel actor
Diffstat (limited to 'client/src/app/root.component.ts')
-rw-r--r--client/src/app/root.component.ts14
1 files changed, 8 insertions, 6 deletions
diff --git a/client/src/app/root.component.ts b/client/src/app/root.component.ts
index ae999e058..5a09e50d1 100644
--- a/client/src/app/root.component.ts
+++ b/client/src/app/root.component.ts
@@ -23,19 +23,21 @@ export class RootComponent implements OnInit {
23 .pipe( 23 .pipe(
24 map(params => params[ 'actorName' ]), 24 map(params => params[ 'actorName' ]),
25 distinctUntilChanged(), 25 distinctUntilChanged(),
26 switchMap(actorName => this.actorService.getActor(actorName)), 26 switchMap(actorName => this.actorService.getActorType(actorName)),
27 catchError(err => this.restExtractor.redirectTo404IfNotFound(err, 'other', [ 27 catchError(err => this.restExtractor.redirectTo404IfNotFound(err, 'other', [
28 HttpStatusCode.BAD_REQUEST_400, 28 HttpStatusCode.BAD_REQUEST_400,
29 HttpStatusCode.NOT_FOUND_404 29 HttpStatusCode.NOT_FOUND_404
30 ])) 30 ]))
31 ) 31 )
32 .subscribe(actor => { 32 .subscribe(actorType => {
33 if (/\/accounts\//.test(actor.url)) { 33 const actorName = this.route.snapshot.params[ 'actorName' ]
34 this.router.navigate([ `/a/${actor.name}` ], { state: { type: 'others', obj: { status: 200 } }, skipLocationChange: true }) 34
35 if (actorType === 'Account') {
36 this.router.navigate([ `/a/${actorName}` ], { state: { type: 'others', obj: { status: 200 } }, skipLocationChange: true })
35 } 37 }
36 38
37 if (/\/video-channels\//.test(actor.url)) { 39 if (actorType === 'VideoChannel') {
38 this.router.navigate([ `/c/${actor.name}` ], { state: { type: 'others', obj: { status: 200 } }, skipLocationChange: true }) 40 this.router.navigate([ `/c/${actorName}` ], { state: { type: 'others', obj: { status: 200 } }, skipLocationChange: true })
39 } 41 }
40 }) 42 })
41 } 43 }