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
This commit is contained in:
creations 2026-04-23 13:42:06 -04:00 • committed by GitHub
parent 40b161e9a3
commit 38101ecf8f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 71 additions and 7 deletions

View file

@ -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<string, string> = { 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<React.ReactNode>(null);
useEffect(() => {
if (!channel) return;
if (channel.isForumLikeChannel()) {
requireForumView().then(() => {
setViewComponent(
<ForumView
channel={channel}
guild={guild}
sidebarState={null}
/>
);
});
setViewComponent(
<div className={ChatClasses.loader}>
<WanderingCubesLoading />
</div>
);
} else {
setViewComponent(
<Chat
channel={channel}
guild={guild}
chatInputType={ChatInputTypes.NORMAL}
/>
);
}
}, [channel, guild]);
return (
<PopoutWindow
withTitleBar
@ -537,8 +580,8 @@ const RenderPopout = ErrorBoundary.wrap(({ channel, name, windowKey }: { channel
channelId={channel.id}
contentClassName={cl("popout")}
>
<div className={cl("window")}>
<FullChannelView providedChannel={channel} />
<div className={`${getThemeClasses(theme)} ${cl("window")}`}>
{View}
</div>
</PopoutWindow>
);

View file

@ -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);
}

View file

@ -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) {

View file

@ -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<string, any>;
@ -125,6 +125,10 @@ export default definePlugin({
return originalRenderPopout();
}
if (isPluginEnabled(alwaysExpandProfiles.name)) {
return <ServerProfileLauncher popoutProps={popoutProps} userId={currentUser.id} guildId={currentChannel.getGuildId()!} />;
}
return (
<UserProfile
{...popoutProps}
@ -136,3 +140,14 @@ export default definePlugin({
);
}, { noop: true })
});
function ServerProfileLauncher({ popoutProps, userId, guildId }: { popoutProps: Record<string, any>; 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;
}