mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-12 23:01:40 +00:00
Sort public rooms again by member count (#1083)
This commit is contained in:
parent
02b150fd13
commit
e37720be44
@ -18,6 +18,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@ -112,6 +113,11 @@ func GetPostPublicRoomsWithExternal(
|
|||||||
haveRoomIDs[r.RoomID] = true
|
haveRoomIDs[r.RoomID] = true
|
||||||
publicRooms = append(publicRooms, r)
|
publicRooms = append(publicRooms, r)
|
||||||
}
|
}
|
||||||
|
// sort by member count
|
||||||
|
sort.SliceStable(publicRooms, func(i, j int) bool {
|
||||||
|
return publicRooms[i].JoinedMembersCount > publicRooms[j].JoinedMembersCount
|
||||||
|
})
|
||||||
|
|
||||||
response.Chunk = publicRooms
|
response.Chunk = publicRooms
|
||||||
|
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
|
Loading…
Reference in New Issue
Block a user