From 1dfdb977efd78a9195be05c4de82723f5c0b6b31 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 8 Apr 2021 22:28:29 -0400 Subject: [PATCH] Communities page sorts by monthly active users. Fixes #244 --- src/shared/components/communities.tsx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/shared/components/communities.tsx b/src/shared/components/communities.tsx index 953e9f1c..ad12cca3 100644 --- a/src/shared/components/communities.tsx +++ b/src/shared/components/communities.tsx @@ -65,9 +65,6 @@ export class Communities extends Component { // Only fetch the data if coming from another route if (this.isoData.path == this.context.router.route.match.url) { this.state.communities = this.isoData.routeData[0].communities; - this.state.communities.sort( - (a, b) => b.counts.subscribers - a.counts.subscribers - ); this.state.loading = false; } else { this.refetch(); @@ -283,7 +280,7 @@ export class Communities extends Component { refetch() { let listCommunitiesForm: ListCommunities = { type_: ListingType.All, - sort: SortType.TopAll, + sort: SortType.TopMonth, limit: communityLimit, page: this.state.page, auth: authField(false), @@ -299,7 +296,7 @@ export class Communities extends Component { let page = pathSplit[3] ? Number(pathSplit[3]) : 1; let listCommunitiesForm: ListCommunities = { type_: ListingType.All, - sort: SortType.TopAll, + sort: SortType.TopMonth, limit: communityLimit, page, }; @@ -317,9 +314,6 @@ export class Communities extends Component { } else if (op == UserOperation.ListCommunities) { let data = wsJsonToRes(msg).data; this.state.communities = data.communities; - this.state.communities.sort( - (a, b) => b.counts.subscribers - a.counts.subscribers - ); this.state.loading = false; window.scrollTo(0, 0); this.setState(this.state);