UserVoiceShow: Fix showing hidden channels

This commit is contained in:
Nuckyz 2024-09-22 13:05:08 -03:00
parent b1db18c319
commit 65069c673c
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -145,6 +145,8 @@ export const VoiceChannelIndicator = ErrorBoundary.wrap(({ userId, isMessageIndi
if (channel == null) return null; if (channel == null) return null;
const isDM = channel.isDM() || channel.isMultiUserDM(); const isDM = channel.isDM() || channel.isMultiUserDM();
if (!isDM && !PermissionStore.can(PermissionsBits.VIEW_CHANNEL, channel) && !Vencord.Plugins.isPluginEnabled("ShowHiddenChannels")) return null;
const isLocked = !isDM && (!PermissionStore.can(PermissionsBits.VIEW_CHANNEL, channel) || !PermissionStore.can(PermissionsBits.CONNECT, channel)); const isLocked = !isDM && (!PermissionStore.can(PermissionsBits.VIEW_CHANNEL, channel) || !PermissionStore.can(PermissionsBits.CONNECT, channel));
function onClick(e: React.MouseEvent) { function onClick(e: React.MouseEvent) {
@ -153,11 +155,6 @@ export const VoiceChannelIndicator = ErrorBoundary.wrap(({ userId, isMessageIndi
if (channel == null || channelId == null) return; if (channel == null || channelId == null) return;
if (!isDM && !PermissionStore.can(PermissionsBits.VIEW_CHANNEL, channel)) {
showToast("You cannot view the user's Voice Channel", Toasts.Type.FAILURE);
return;
}
clearTimeout(clickTimers[channelId]); clearTimeout(clickTimers[channelId]);
delete clickTimers[channelId]; delete clickTimers[channelId];