diff --git a/src/api/routes/channels/#channel_id/messages/index.ts b/src/api/routes/channels/#channel_id/messages/index.ts index 42bb82735..46ef45f08 100644 --- a/src/api/routes/channels/#channel_id/messages/index.ts +++ b/src/api/routes/channels/#channel_id/messages/index.ts @@ -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 diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts index 4dc4fb83c..c0d26dc55 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts @@ -171,6 +171,7 @@ export async function handleMessage(opts: MessageOptions): Promise { 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"); } diff --git a/src/util/entities/User.ts b/src/util/entities/User.ts index 9a5f0d950..cd46850fc 100644 --- a/src/util/entities/User.ts +++ b/src/util/entities/User.ts @@ -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) => {