perf(api): fetch channel permissions in one gateway call (#2145)

This commit is contained in:
Hampus authored and GitHub committed 2026-08-30 22:17:23 +02:00
1 parent 12717f692b
commit c207918e90
1 file changed
+6 -1
@@ -179,8 +179,13 @@ export abstract class BaseChannelAuthService {
guildData: guildDataResult!, guildData: guildDataResult!,
userId, userId,
}); });
const channelPermissions = await this.gatewayService.getUserPermissions({
guildId,
userId,
channelId: channel.id,
});
const hasPermission = async (permission: bigint): Promise<boolean> => { const hasPermission = async (permission: bigint): Promise<boolean> => {
const allowed = await this.gatewayService.checkPermission({guildId, userId, permission, channelId: channel.id}); const allowed = (channelPermissions & permission) === permission;
if (allowed) enforceGuildMfa(permission); if (allowed) enforceGuildMfa(permission);
return allowed; return allowed;
}; };