mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-29 15:51:14 +00:00
Merge pull request #259 from LemmyNet/community_sort_top_monthly
Communities page sorts by monthly active users. Fixes #244
This commit is contained in:
commit
733e4a413b
1 changed files with 2 additions and 8 deletions
|
@ -65,9 +65,6 @@ export class Communities extends Component<any, CommunitiesState> {
|
||||||
// Only fetch the data if coming from another route
|
// Only fetch the data if coming from another route
|
||||||
if (this.isoData.path == this.context.router.route.match.url) {
|
if (this.isoData.path == this.context.router.route.match.url) {
|
||||||
this.state.communities = this.isoData.routeData[0].communities;
|
this.state.communities = this.isoData.routeData[0].communities;
|
||||||
this.state.communities.sort(
|
|
||||||
(a, b) => b.counts.subscribers - a.counts.subscribers
|
|
||||||
);
|
|
||||||
this.state.loading = false;
|
this.state.loading = false;
|
||||||
} else {
|
} else {
|
||||||
this.refetch();
|
this.refetch();
|
||||||
|
@ -283,7 +280,7 @@ export class Communities extends Component<any, CommunitiesState> {
|
||||||
refetch() {
|
refetch() {
|
||||||
let listCommunitiesForm: ListCommunities = {
|
let listCommunitiesForm: ListCommunities = {
|
||||||
type_: ListingType.All,
|
type_: ListingType.All,
|
||||||
sort: SortType.TopAll,
|
sort: SortType.TopMonth,
|
||||||
limit: communityLimit,
|
limit: communityLimit,
|
||||||
page: this.state.page,
|
page: this.state.page,
|
||||||
auth: authField(false),
|
auth: authField(false),
|
||||||
|
@ -299,7 +296,7 @@ export class Communities extends Component<any, CommunitiesState> {
|
||||||
let page = pathSplit[3] ? Number(pathSplit[3]) : 1;
|
let page = pathSplit[3] ? Number(pathSplit[3]) : 1;
|
||||||
let listCommunitiesForm: ListCommunities = {
|
let listCommunitiesForm: ListCommunities = {
|
||||||
type_: ListingType.All,
|
type_: ListingType.All,
|
||||||
sort: SortType.TopAll,
|
sort: SortType.TopMonth,
|
||||||
limit: communityLimit,
|
limit: communityLimit,
|
||||||
page,
|
page,
|
||||||
};
|
};
|
||||||
|
@ -317,9 +314,6 @@ export class Communities extends Component<any, CommunitiesState> {
|
||||||
} else if (op == UserOperation.ListCommunities) {
|
} else if (op == UserOperation.ListCommunities) {
|
||||||
let data = wsJsonToRes<ListCommunitiesResponse>(msg).data;
|
let data = wsJsonToRes<ListCommunitiesResponse>(msg).data;
|
||||||
this.state.communities = data.communities;
|
this.state.communities = data.communities;
|
||||||
this.state.communities.sort(
|
|
||||||
(a, b) => b.counts.subscribers - a.counts.subscribers
|
|
||||||
);
|
|
||||||
this.state.loading = false;
|
this.state.loading = false;
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
|
|
Loading…
Reference in a new issue