mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
perf(api): fetch channel permissions in one gateway call (#2145)
This commit is contained in:
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;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user