improve settings ui

This commit is contained in:
Vendicated 2024-06-29 20:18:29 +02:00
parent 8a7c0d7e61
commit 5c05443f45
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
11 changed files with 422 additions and 194 deletions

View file

@ -477,12 +477,17 @@ export default definePlugin({
],
isHiddenChannel(channel: Channel & { channelId?: string; }, checkConnect = false) {
if (!channel) return false;
try {
if (!channel) return false;
if (channel.channelId) channel = ChannelStore.getChannel(channel.channelId);
if (!channel || channel.isDM() || channel.isGroupDM() || channel.isMultiUserDM()) return false;
if (channel.channelId) channel = ChannelStore.getChannel(channel.channelId);
if (!channel || channel.isDM() || channel.isGroupDM() || channel.isMultiUserDM()) return false;
return !PermissionStore.can(PermissionsBits.VIEW_CHANNEL, channel) || checkConnect && !PermissionStore.can(PermissionsBits.CONNECT, channel);
return !PermissionStore.can(PermissionsBits.VIEW_CHANNEL, channel) || checkConnect && !PermissionStore.can(PermissionsBits.CONNECT, channel);
} catch (e) {
console.error("[ViewHiddenChannels#isHiddenChannel]: ", e);
return false;
}
},
resolveGuildChannels(channels: Record<string | number, Array<{ channel: Channel; comparator: number; }> | string | number>, shouldIncludeHidden: boolean) {