AlwaysExpandProfiles: Fix glitched modal
This commit is contained in:
parent
69855b6ec1
commit
345ecd11ad
2 changed files with 6 additions and 10 deletions
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue