ShowHiddenChannels: Fix erroring when avoiding fetching channel messages

This commit is contained in:
Nuckyz 2025-05-30 11:49:32 -03:00
parent eafbc0d15a
commit f0fcaf734e
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -494,10 +494,10 @@ export default definePlugin({
isHiddenChannel(channel: Channel & { channelId?: string; }, checkConnect = false) {
try {
if (!channel) return false;
if (channel == null || Object.hasOwn(channel, "channelId") && channel.channelId == null) return false;
if (channel.channelId) channel = ChannelStore.getChannel(channel.channelId);
if (!channel || channel.isDM() || channel.isGroupDM() || channel.isMultiUserDM()) return false;
if (channel.channelId != null) channel = ChannelStore.getChannel(channel.channelId);
if (channel == null || channel.isDM() || channel.isGroupDM() || channel.isMultiUserDM()) return false;
return !PermissionStore.can(PermissionsBits.VIEW_CHANNEL, channel) || checkConnect && !PermissionStore.can(PermissionsBits.CONNECT, channel);
} catch (e) {