Sort livestreams per viewCount, descending

This commit is contained in:
infinite-persistence 2022-05-02 18:44:16 +08:00 committed by Thomas Zarebczan
parent 61d0d76c1c
commit dc46af34ec

View file

@ -52,6 +52,14 @@ export function getLivestreamUris(
values = values.filter((v) => !excludedChannelIds.includes(v.creatorId));
}
values = values.sort((a, b) => {
// $FlowFixMe
if (a.viewCount < b.viewCount) return 1;
// $FlowFixMe
else if (a.viewCount > b.viewCount) return -1;
else return 0;
});
// $FlowFixMe
return values.map((v) => v.claimUri);
}