From: Dessalines Date: Sat, 23 Jan 2021 23:23:09 +0000 (-0500) Subject: Fixing views for remote users. Fixes #120 X-Git-Url: http://these/git/%22https:/www.exeterceilidhs.net/%22%7B%7D/%7B%7D/inbox?a=commitdiff_plain;h=8c3c27002bf0c2b0b21727492b8ee3c8aa9b37c1;p=lemmy-ui.git Fixing views for remote users. Fixes #120 --- diff --git a/src/shared/components/user.tsx b/src/shared/components/user.tsx index 555951e..92b50b6 100644 --- a/src/shared/components/user.tsx +++ b/src/shared/components/user.tsx @@ -885,8 +885,13 @@ export class User extends Component { const page = paramUpdates.page || this.state.page; const viewStr = paramUpdates.view || UserDetailsView[this.state.view]; const sortStr = paramUpdates.sort || this.state.sort; + + let typeView = this.state.userName + ? `/u/${this.state.userName}` + : `/user/${this.state.userId}`; + this.props.history.push( - `/u/${this.state.userName}/view/${viewStr}/sort/${sortStr}/page/${page}` + `${typeView}/view/${viewStr}/sort/${sortStr}/page/${page}` ); this.state.loading = true; this.setState(this.state); diff --git a/src/shared/routes.ts b/src/shared/routes.ts index 92a412e..c059ad9 100644 --- a/src/shared/routes.ts +++ b/src/shared/routes.ts @@ -92,6 +92,11 @@ export const routes: IRoutePropsWithFetch[] = [ component: User, fetchInitialData: req => User.fetchInitialData(req), }, + { + path: `/user/:id/view/:view/sort/:sort/page/:page`, + component: User, + fetchInitialData: req => User.fetchInitialData(req), + }, { path: `/user/:id`, component: User,