mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-25 11:43:07 +01:00
fix op 8
This commit is contained in:
parent
c51595a6da
commit
bcbd8234e5
@ -27,7 +27,7 @@ import {
|
|||||||
} from "@spacebar/util";
|
} from "@spacebar/util";
|
||||||
import { WebSocket, Payload, OPCODES, Send } from "@spacebar/gateway";
|
import { WebSocket, Payload, OPCODES, Send } from "@spacebar/gateway";
|
||||||
import { check } from "./instanceOf";
|
import { check } from "./instanceOf";
|
||||||
import { FindManyOptions, In, Like } from "typeorm";
|
import { FindManyOptions, ILike, In } from "typeorm";
|
||||||
|
|
||||||
export async function onRequestGuildMembers(this: WebSocket, { d }: Payload) {
|
export async function onRequestGuildMembers(this: WebSocket, { d }: Payload) {
|
||||||
// Schema validation can only accept either string or array, so transforming it here to support both
|
// Schema validation can only accept either string or array, so transforming it here to support both
|
||||||
@ -114,7 +114,7 @@ export async function onRequestGuildMembers(this: WebSocket, { d }: Payload) {
|
|||||||
if (query) {
|
if (query) {
|
||||||
// @ts-expect-error memberFind.where is very much defined
|
// @ts-expect-error memberFind.where is very much defined
|
||||||
memberFind.where.user = {
|
memberFind.where.user = {
|
||||||
username: Like(query + "%"),
|
username: ILike(query + "%"),
|
||||||
};
|
};
|
||||||
} else if (user_ids && user_ids.length > 0) {
|
} else if (user_ids && user_ids.length > 0) {
|
||||||
// @ts-expect-error memberFind.where is still very much defined
|
// @ts-expect-error memberFind.where is still very much defined
|
||||||
@ -166,15 +166,17 @@ export async function onRequestGuildMembers(this: WebSocket, { d }: Payload) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (chunks.length == 0) {
|
||||||
|
chunks.push({
|
||||||
|
...baseData,
|
||||||
|
members: [],
|
||||||
|
presences: presences ? [] : undefined,
|
||||||
|
chunk_index: 0,
|
||||||
|
chunk_count: 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (notFound.length > 0) {
|
if (notFound.length > 0) {
|
||||||
if (chunks.length == 0)
|
|
||||||
chunks.push({
|
|
||||||
...baseData,
|
|
||||||
members: [],
|
|
||||||
presences: presences ? [] : undefined,
|
|
||||||
chunk_index: 0,
|
|
||||||
chunk_count: 1,
|
|
||||||
});
|
|
||||||
chunks[0].not_found = notFound;
|
chunks[0].not_found = notFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,8 +466,8 @@ export class Member extends BaseClassWithoutId {
|
|||||||
member[x] = this[x];
|
member[x] = this[x];
|
||||||
});
|
});
|
||||||
|
|
||||||
if (member.roles) member.roles = member.roles.map((x: Role) => x.id);
|
if (this.roles) member.roles = this.roles.map((x: Role) => x.id);
|
||||||
if (member.user) member.user = member.user.toPublicUser();
|
if (this.user) member.user = this.user.toPublicUser();
|
||||||
|
|
||||||
return member as PublicMember;
|
return member as PublicMember;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user