A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
perf(api): fetch channel permissions in one gateway call (#2145)
Hampusc207918e908a
diff --git a/fluxer_api/src/api/channel/services/BaseChannelAuthService.ts b/fluxer_api/src/api/channel/services/BaseChannelAuthService.tsindex 1770a3797..9103c8d42 100644--- a/fluxer_api/src/api/channel/services/BaseChannelAuthService.ts+++ b/fluxer_api/src/api/channel/services/BaseChannelAuthService.ts@@ -179,8 +179,13 @@ export abstract class BaseChannelAuthService {guildData: guildDataResult!,userId,});+ const channelPermissions = await this.gatewayService.getUserPermissions({+ guildId,+ userId,+ channelId: channel.id,+ });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);return allowed;};