mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-22 02:12:40 +01:00
Merge pull request #1198 from DEVTomatoCake/fix/lazy-request-filter
This commit is contained in:
commit
7e60f8b998
@ -68,7 +68,6 @@ async function getMembers(guild_id: string, range: [number, number]) {
|
|||||||
if (!Array.isArray(range) || range.length !== 2) {
|
if (!Array.isArray(range) || range.length !== 2) {
|
||||||
throw new Error("range is not a valid array");
|
throw new Error("range is not a valid array");
|
||||||
}
|
}
|
||||||
// TODO: wait for typeorm to implement ordering for .find queries https://github.com/typeorm/typeorm/issues/2620
|
|
||||||
|
|
||||||
let members: Member[] = [];
|
let members: Member[] = [];
|
||||||
try {
|
try {
|
||||||
@ -82,11 +81,11 @@ async function getMembers(guild_id: string, range: [number, number]) {
|
|||||||
.leftJoinAndSelect("user.sessions", "session")
|
.leftJoinAndSelect("user.sessions", "session")
|
||||||
.addSelect("user.settings")
|
.addSelect("user.settings")
|
||||||
.addSelect(
|
.addSelect(
|
||||||
"CASE WHEN session.status = 'offline' THEN 0 ELSE 1 END",
|
"CASE WHEN session.status IS NULL OR session.status = 'offline' OR session.status = 'invisible' THEN 0 ELSE 1 END",
|
||||||
"_status",
|
"_status",
|
||||||
)
|
)
|
||||||
.orderBy("role.position", "DESC")
|
.orderBy("_status", "DESC")
|
||||||
.addOrderBy("_status", "DESC")
|
.addOrderBy("role.position", "DESC")
|
||||||
.addOrderBy("user.username", "ASC")
|
.addOrderBy("user.username", "ASC")
|
||||||
.offset(Number(range[0]) || 0)
|
.offset(Number(range[0]) || 0)
|
||||||
.limit(Number(range[1]) || 100)
|
.limit(Number(range[1]) || 100)
|
||||||
|
Loading…
Reference in New Issue
Block a user