added clean_data to places after a member is created but not constructed to allow proper json creation.

This commit is contained in:
whinis
2026-02-25 08:57:05 -05:00
committed by Rory&
parent 0a1e4e9d6b
commit 3e7ecbc4a1
3 changed files with 4 additions and 0 deletions

View File

@@ -481,6 +481,7 @@ router.post(
where: { id: req.user_id, guild_id: message.guild_id },
relations: { roles: true },
});
message.member.clean_data();
}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment

View File

@@ -171,6 +171,7 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> {
message.author = await User.findOneOrFail({
where: { id: opts.author_id },
});
message.author.clean_data();
const rights = await getRights(opts.author_id);
rights.hasThrow("SEND_MESSAGES");
}

View File

@@ -212,6 +212,7 @@ export class User extends BaseClass {
}
toPublicUser() {
this.clean_data();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const user: any = {};
PublicUserProjection.forEach((x) => {
@@ -221,6 +222,7 @@ export class User extends BaseClass {
}
toPrivateUser(extraFields: (keyof User)[] = []) {
this.clean_data();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const user: any = {};
[...PrivateUserProjection, ...extraFields].forEach((x) => {