diff --git a/src/equicordplugins/alwaysExpandProfiles/index.ts b/src/equicordplugins/alwaysExpandProfiles/index.ts index 11d9438e6..acbfca3fb 100644 --- a/src/equicordplugins/alwaysExpandProfiles/index.ts +++ b/src/equicordplugins/alwaysExpandProfiles/index.ts @@ -5,7 +5,6 @@ */ import { Devs } from "@utils/constants"; -import { openUserProfile } from "@utils/discord"; import definePlugin from "@utils/types"; export default definePlugin({ @@ -17,13 +16,10 @@ export default definePlugin({ { find: '"view-profile"', replacement: { - match: /(\.POPOUT_CLOSE.{0,200})return(?<=userId:(\i\.id).*?)/, - replace: "$1return $self.openUserModal($2);" + match: /(\i)=.{0,45}\(0,\i\.openUserProfileModal.{0,300}(?=return)/, + replace: "$&return $1();" }, all: true }, ], - openUserModal(userId: string) { - openUserProfile(userId); - } }); diff --git a/src/plugins/accountPanelServerProfile/index.tsx b/src/plugins/accountPanelServerProfile/index.tsx index 3edc7f510..3dd778b4f 100644 --- a/src/plugins/accountPanelServerProfile/index.tsx +++ b/src/plugins/accountPanelServerProfile/index.tsx @@ -9,7 +9,7 @@ import { definePluginSettings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import alwaysExpandProfiles from "@equicordplugins/alwaysExpandProfiles"; import { Devs } from "@utils/constants"; -import { fetchUserProfile, getCurrentChannel } from "@utils/discord"; +import { fetchUserProfile, getCurrentChannel, openUserProfile } from "@utils/discord"; import definePlugin, { OptionType } from "@utils/types"; import { User } from "@vencord/discord-types"; import { findComponentByCodeLazy } from "@webpack"; @@ -41,9 +41,9 @@ const AccountPanelContextMenu = ErrorBoundary.wrap(() => { action={async e => { if (isPluginEnabled(alwaysExpandProfiles.name)) { const user = await fetchUserProfile(UserStore.getCurrentUser().id, { - guild_id: getCurrentChannel()?.getGuildId() + guild_id: prioritizeServerProfile ? undefined : getCurrentChannel()?.getGuildId() }, false); - return alwaysExpandProfiles.openUserModal(user!.userId); + return openUserProfile(user!.userId); } openAlternatePopout = true; accountPanelRef.current?.click(); @@ -146,7 +146,7 @@ function ServerProfileLauncher({ popoutProps, userId, guildId }: { popoutProps: popoutProps.closePopout?.(); popoutProps.onRequestClose?.(); fetchUserProfile(userId, { guild_id: guildId }, false).then(user => { - if (user) alwaysExpandProfiles.openUserModal(user.userId); + if (user) openUserProfile(user.userId); }); }, []); return null;