From 38101ecf8f0aba13a7e6892bed8ef0cfe3f4f8c0 Mon Sep 17 00:00:00 2001 From: creations Date: Thu, 23 Apr 2026 13:42:06 -0400 Subject: [PATCH] fix some bug reports (#1010) * fix conflict with AccountPanelServerProfile and AlwaysExpandProfiles * fix SidebarChat popup window doesn't use theme * VoiceJoinMessages notifies about inaccessible VCs also fix return to continue, used to drop for any blocked, same channel * another popout issue --- src/equicordplugins/sidebarChat/index.tsx | 49 +++++++++++++++++-- src/equicordplugins/sidebarChat/styles.css | 3 ++ .../voiceJoinMessages/index.ts | 9 ++-- .../accountPanelServerProfile/index.tsx | 17 ++++++- 4 files changed, 71 insertions(+), 7 deletions(-) diff --git a/src/equicordplugins/sidebarChat/index.tsx b/src/equicordplugins/sidebarChat/index.tsx index 9beaad8ae..7fb269d0f 100644 --- a/src/equicordplugins/sidebarChat/index.tsx +++ b/src/equicordplugins/sidebarChat/index.tsx @@ -38,6 +38,7 @@ import { RelationshipStore, SelectedChannelStore, SelectedGuildStore, + ThemeStore, useCallback, useEffect, useLayoutEffect, @@ -58,6 +59,14 @@ import { const cl = classNameFactory("vc-sidebar-chat-"); +const themeParents: Record = { darker: "dark", midnight: "dark" }; +function getThemeClasses(theme: string) { + const parent = themeParents[theme]; + return parent + ? `theme-${parent} theme-${theme} images-${parent}` + : `theme-${theme} images-${theme}`; +} + const HeaderBar = findComponentByCodeLazy("toolbarClassName:", "}),onDoubleClick:"); const ForumView = findComponentByCodeLazy("sidebarState"); @@ -81,7 +90,6 @@ const Chat = findComponentByCodeLazy("filterAfterTimestamp:", "chatInputType"); const Resize = findComponentByCodeLazy("sidebarType:", "RESIZE_HANDLE_WIDTH)"); const ChannelHeader = findComponentByCodeLazy(".GUILD_ANNOUNCEMENT", "`channel-"); const PopoutWindow = findComponentByCodeLazy("Missing guestWindow reference"); -const FullChannelView = findComponentByCodeLazy(/showFollowButton:\i\?\.type===/); const WanderingCubesLoading = findComponentByCodeLazy('="wanderingCubes"'); const ChatInputTypes = findByPropsLazy("FORM", "NORMAL"); @@ -529,6 +537,41 @@ const RenderPopout = ErrorBoundary.wrap(({ channel, name, windowKey }: { channel }); }, [channel?.id]); + const theme = useStateFromStores([ThemeStore], () => ThemeStore?.theme ?? "dark"); + const guild = useStateFromStores([GuildStore], () => channel.guild_id ? GuildStore.getGuild(channel.guild_id) : null, [channel.guild_id]); + + const [View, setViewComponent] = useState(null); + + useEffect(() => { + if (!channel) return; + + if (channel.isForumLikeChannel()) { + requireForumView().then(() => { + setViewComponent( + + ); + }); + + setViewComponent( +
+ +
+ ); + } else { + setViewComponent( + + ); + } + }, [channel, guild]); + return ( -
- +
+ {View}
); diff --git a/src/equicordplugins/sidebarChat/styles.css b/src/equicordplugins/sidebarChat/styles.css index fa51b7e10..3c5ab7d40 100644 --- a/src/equicordplugins/sidebarChat/styles.css +++ b/src/equicordplugins/sidebarChat/styles.css @@ -4,6 +4,7 @@ .vc-sidebar-chat-popout { align-items: stretch; + background-color: var(--background-primary); } .vc-sidebar-chat-window { @@ -13,4 +14,6 @@ min-width: 0; overflow: hidden; width: 100%; + background-color: var(--background-primary); + color: var(--text-default); } diff --git a/src/equicordplugins/voiceJoinMessages/index.ts b/src/equicordplugins/voiceJoinMessages/index.ts index 3fdc3499b..2c69e9159 100644 --- a/src/equicordplugins/voiceJoinMessages/index.ts +++ b/src/equicordplugins/voiceJoinMessages/index.ts @@ -10,7 +10,7 @@ import { humanFriendlyJoin } from "@utils/text"; import definePlugin, { OptionType } from "@utils/types"; import { Message, User } from "@vencord/discord-types"; import { findByCodeLazy } from "@webpack"; -import { ChannelStore, FluxDispatcher, MessageActions, MessageStore, RelationshipStore, SelectedChannelStore, UserStore } from "@webpack/common"; +import { ChannelStore, FluxDispatcher, MessageActions, MessageStore, PermissionsBits, PermissionStore, RelationshipStore, SelectedChannelStore, UserStore } from "@webpack/common"; const createBotMessage = findByCodeLazy('username:"Clyde"'); @@ -125,12 +125,15 @@ export default definePlugin({ oldChannelId = clientOldChannelId; clientOldChannelId = channelId; } - if (settings.store.ignoreBlockedUsers && RelationshipStore.isBlocked(userId)) return; + if (settings.store.ignoreBlockedUsers && RelationshipStore.isBlocked(userId)) continue; // Ignore events from same channel - if (oldChannelId === channelId) return; + if (oldChannelId === channelId) continue; // Friend joined a voice channel if (settings.store.friendDirectMessages && (!oldChannelId && channelId) && userId !== clientUserId && isFriendAllowlisted(userId)) { + const channel = ChannelStore.getChannel(channelId); + if (!channel || !PermissionStore.can(PermissionsBits.VIEW_CHANNEL, channel)) continue; + const selfInChannel = SelectedChannelStore.getVoiceChannelId() === channelId; let memberListContent = ""; if (settings.store.friendDirectMessagesShowMembers || settings.store.friendDirectMessagesShowMemberCount) { diff --git a/src/plugins/accountPanelServerProfile/index.tsx b/src/plugins/accountPanelServerProfile/index.tsx index b1d83037d..3edc7f510 100644 --- a/src/plugins/accountPanelServerProfile/index.tsx +++ b/src/plugins/accountPanelServerProfile/index.tsx @@ -13,7 +13,7 @@ import { fetchUserProfile, getCurrentChannel } from "@utils/discord"; import definePlugin, { OptionType } from "@utils/types"; import { User } from "@vencord/discord-types"; import { findComponentByCodeLazy } from "@webpack"; -import { ContextMenuApi, Menu, UserStore } from "@webpack/common"; +import { ContextMenuApi, Menu, useEffect, UserStore } from "@webpack/common"; interface UserProfileProps { popoutProps: Record; @@ -125,6 +125,10 @@ export default definePlugin({ return originalRenderPopout(); } + if (isPluginEnabled(alwaysExpandProfiles.name)) { + return ; + } + return ( ; userId: string; guildId: string; }) { + useEffect(() => { + popoutProps.closePopout?.(); + popoutProps.onRequestClose?.(); + fetchUserProfile(userId, { guild_id: guildId }, false).then(user => { + if (user) alwaysExpandProfiles.openUserModal(user.userId); + }); + }, []); + return null; +}