Skip to content

Commit

Permalink
AccountPanelServerProfile: Fix buttons unusable and request spam
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuckyz committed Jan 22, 2025
1 parent 9bb983d commit 9e9d71d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/plugins/accountPanelServerProfile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { User } from "discord-types/general";
interface UserProfileProps {
popoutProps: Record<string, any>;
currentUser: User;
OriginalPopout: () => React.ReactNode;
originalRenderPopout: () => React.ReactNode;
}

const UserProfile = findComponentByCodeLazy("UserProfilePopoutWrapper: user cannot be undefined");
Expand Down Expand Up @@ -78,7 +78,7 @@ export default definePlugin({
},
{
match: /(\.AVATAR,children:.+?renderPopout:(\i)=>){(.+?)}(?=,position)(?<=currentUser:(\i).+?)/,
replace: (_, rest, popoutProps, originalPopout, currentUser) => `${rest}$self.UserProfile({popoutProps:${popoutProps},currentUser:${currentUser},OriginalPopout:()=>{${originalPopout}}})`
replace: (_, rest, popoutProps, originalPopout, currentUser) => `${rest}$self.UserProfile({popoutProps:${popoutProps},currentUser:${currentUser},originalRenderPopout:()=>{${originalPopout}}})`
},
{
match: /\.AVATAR,children:.+?(?=renderPopout:)/,
Expand Down Expand Up @@ -112,17 +112,17 @@ export default definePlugin({
openAlternatePopout = false;
},

UserProfile: ErrorBoundary.wrap(({ popoutProps, currentUser, OriginalPopout }: UserProfileProps) => {
UserProfile: ErrorBoundary.wrap(({ popoutProps, currentUser, originalRenderPopout }: UserProfileProps) => {
if (
(settings.store.prioritizeServerProfile && openAlternatePopout) ||
(!settings.store.prioritizeServerProfile && !openAlternatePopout)
) {
return <OriginalPopout />;
return originalRenderPopout();
}

const currentChannel = getCurrentChannel();
if (currentChannel?.getGuildId() == null) {
return <OriginalPopout />;
return originalRenderPopout();
}

return (
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/fullUserInChatbox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface UserMentionComponentProps {
id: string;
channelId: string;
guildId: string;
OriginalComponent: () => ReactNode;
originalComponent: () => ReactNode;
}

export default definePlugin({
Expand All @@ -29,7 +29,7 @@ export default definePlugin({
find: ':"text":',
replacement: {
match: /(hidePersonalInformation\).+?)(if\(null!=\i\){.+?return \i)(?=})/,
replace: "$1return $self.UserMentionComponent({...arguments[0],OriginalComponent:()=>{$2}});"
replace: "$1return $self.UserMentionComponent({...arguments[0],originalComponent:()=>{$2}});"
}
}
],
Expand All @@ -42,6 +42,6 @@ export default definePlugin({
channelId={props.channelId}
/>
), {
fallback: ({ wrappedProps: { OriginalComponent } }) => <OriginalComponent />
fallback: ({ wrappedProps: { originalComponent } }) => originalComponent()
})
});

0 comments on commit 9e9d71d

Please sign in to comment.