From 055f7bb0db7b7b457b2a220cc108df90f606bd65 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 19 Jul 2021 09:04:06 -0400 Subject: [PATCH 1/2] Don't use default subscribed for communities page. --- src/shared/components/community/communities.tsx | 12 ++++-------- src/shared/utils.ts | 6 ++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/shared/components/community/communities.tsx b/src/shared/components/community/communities.tsx index c3dab588..aa34be35 100644 --- a/src/shared/components/community/communities.tsx +++ b/src/shared/components/community/communities.tsx @@ -13,10 +13,10 @@ import { import { Subscription } from "rxjs"; import { InitialFetchRequest } from "shared/interfaces"; import { i18n } from "../../i18next"; -import { UserService, WebSocketService } from "../../services"; +import { WebSocketService } from "../../services"; import { authField, - getListingTypeFromProps, + getListingTypeFromPropsNoDefault, getPageFromProps, isBrowser, setIsoData, @@ -57,7 +57,7 @@ export class Communities extends Component { communities: [], loading: true, page: getPageFromProps(this.props), - listingType: getListingTypeFromProps(this.props), + listingType: getListingTypeFromPropsNoDefault(this.props), site_view: this.isoData.site_res.site_view, searchText: "", }; @@ -88,7 +88,7 @@ export class Communities extends Component { static getDerivedStateFromProps(props: any): CommunitiesProps { return { - listingType: getListingTypeFromProps(props), + listingType: getListingTypeFromPropsNoDefault(props), page: getPageFromProps(props), }; } @@ -298,10 +298,6 @@ export class Communities extends Component { let pathSplit = req.path.split("/"); let type_: ListingType = pathSplit[3] ? ListingType[pathSplit[3]] - : UserService.Instance.localUserView - ? Object.values(ListingType)[ - UserService.Instance.localUserView.local_user.default_listing_type - ] : ListingType.Local; let page = pathSplit[5] ? Number(pathSplit[5]) : 1; let listCommunitiesForm: ListCommunities = { diff --git a/src/shared/utils.ts b/src/shared/utils.ts index 49801d43..34588358 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -854,6 +854,12 @@ export function getListingTypeFromProps(props: any): ListingType { : ListingType.Local; } +export function getListingTypeFromPropsNoDefault(props: any): ListingType { + return props.match.params.listing_type + ? routeListingTypeToEnum(props.match.params.listing_type) + : ListingType.Local; +} + // TODO might need to add a user setting for this too export function getDataTypeFromProps(props: any): DataType { return props.match.params.data_type From 9f8218822332d9cdeaae1b9d7b2849f1c42bbf0f Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 19 Jul 2021 09:54:03 -0400 Subject: [PATCH 2/2] Updating translations. --- lemmy-translations | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lemmy-translations b/lemmy-translations index 6baf8609..e34e6fc9 160000 --- a/lemmy-translations +++ b/lemmy-translations @@ -1 +1 @@ -Subproject commit 6baf8609698c19f698d3056a3d804cb2ae6eddb4 +Subproject commit e34e6fc90f5702683870ab548ebe98a29c70abb3