Merge pull request #1449 from MathMan05/inviteFix

This commit is contained in:
Cyber
2025-12-22 20:57:08 +01:00
committed by GitHub
2 changed files with 7 additions and 1 deletions

View File

@@ -44,7 +44,7 @@ router.get(
relations: PublicInviteRelation,
});
res.status(200).send(invite);
res.status(200).send(invite.toPublicJSON());
},
);

View File

@@ -104,6 +104,12 @@ export class Invite extends BaseClassWithoutId {
if (this.max_uses !== 0 && this.uses >= this.max_uses) return true;
return false;
}
toPublicJSON() {
return {
...this,
inviter: this.inviter.toPublicUser(),
};
}
static async joinGuild(user_id: string, code: string) {
const invite = await Invite.findOneOrFail({ where: { code } });