From: Dessalines Date: Mon, 8 Feb 2021 20:14:34 +0000 (-0500) Subject: Fixing broken federated community paging. Fixes #166 X-Git-Url: http://these/git/%7B%60https:/%7BpictrsAvatarThumbnail%28user.avatar%29%7D?a=commitdiff_plain;h=4b43cdf1431393f638642b33880577add5fd8ce0;p=lemmy-ui.git Fixing broken federated community paging. Fixes #166 --- diff --git a/src/shared/components/community.tsx b/src/shared/components/community.tsx index 2865a25..86ac243 100644 --- a/src/shared/components/community.tsx +++ b/src/shared/components/community.tsx @@ -405,8 +405,13 @@ export class Community extends Component { const dataTypeStr = paramUpdates.dataType || DataType[this.state.dataType]; const sortStr = paramUpdates.sort || this.state.sort; const page = paramUpdates.page || this.state.page; + + let typeView = this.state.communityName + ? `/c/${this.state.communityName}` + : `/community/${this.state.communityId}`; + this.props.history.push( - `/c/${this.state.communityRes.community_view.community.name}/data_type/${dataTypeStr}/sort/${sortStr}/page/${page}` + `${typeView}/data_type/${dataTypeStr}/sort/${sortStr}/page/${page}` ); } diff --git a/src/shared/routes.ts b/src/shared/routes.ts index c059ad9..bef023e 100644 --- a/src/shared/routes.ts +++ b/src/shared/routes.ts @@ -73,7 +73,7 @@ export const routes: IRoutePropsWithFetch[] = [ fetchInitialData: req => Post.fetchInitialData(req), }, { - path: `/c/:name/data_type/:data_type/sort/:sort/page/:page`, + path: `/community/:id/data_type/:data_type/sort/:sort/page/:page`, component: Community, fetchInitialData: req => Community.fetchInitialData(req), }, @@ -82,6 +82,11 @@ export const routes: IRoutePropsWithFetch[] = [ component: Community, fetchInitialData: req => Community.fetchInitialData(req), }, + { + path: `/c/:name/data_type/:data_type/sort/:sort/page/:page`, + component: Community, + fetchInitialData: req => Community.fetchInitialData(req), + }, { path: `/c/:name`, component: Community,