From: Dessalines Date: Mon, 19 Jul 2021 13:04:06 +0000 (-0400) Subject: Don't use default subscribed for communities page. X-Git-Url: http://these/git/%7B%24%7B%60data:application/%22%7Burl%7D/readmes/static/%7BallRss%7D?a=commitdiff_plain;h=055f7bb0db7b7b457b2a220cc108df90f606bd65;p=lemmy-ui.git Don't use default subscribed for communities page. --- diff --git a/src/shared/components/community/communities.tsx b/src/shared/components/community/communities.tsx index c3dab58..aa34be3 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 49801d4..3458835 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