Skip to content

Commit

Permalink
Fix OpenInApp & ShowHiddenThings
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuckyz committed Nov 20, 2024
1 parent cd61f4e commit a0308e0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
12 changes: 8 additions & 4 deletions src/plugins/decor/ui/modals/ChangeDecorationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { openInviteModal } from "@utils/discord";
import { Margins } from "@utils/margins";
import { classes, copyWithToast } from "@utils/misc";
import { closeAllModals, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
import { Queue } from "@utils/Queue";
import { findComponentByCodeLazy } from "@webpack";
import { Alerts, Button, FluxDispatcher, Forms, GuildStore, NavigationRouter, Parser, Text, Tooltip, useEffect, UserStore, UserUtils, useState } from "@webpack/common";
import { User } from "discord-types/general";
Expand Down Expand Up @@ -49,24 +50,27 @@ interface SectionHeaderProps {
section: Section;
}

const fetchAuthorsQueue = new Queue();

function SectionHeader({ section }: SectionHeaderProps) {
const hasSubtitle = typeof section.subtitle !== "undefined";
const hasAuthorIds = typeof section.authorIds !== "undefined";

const [authors, setAuthors] = useState<User[]>([]);

useEffect(() => {
(async () => {
fetchAuthorsQueue.push(async () => {
if (!section.authorIds) return;

for (const authorId of section.authorIds) {
const author = UserStore.getUser(authorId) ?? await UserUtils.getUser(authorId);
const author = UserStore.getUser(authorId) ?? await UserUtils.getUser(authorId).catch(() => null);
if (author == null) continue;

setAuthors(authors => [...authors, author]);
}
})();
});
}, [section.authorIds]);


return <div>
<Flex>
<Forms.FormTitle style={{ flexGrow: 1 }}>{section.title}</Forms.FormTitle>
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/decor/ui/modals/CreateDecorationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function CreateDecorationModal(props: ModalProps) {
/>
</div>
</div>
<HelpMessage messageType={HelpMessageTypes.INFO}>
<HelpMessage messageType={HelpMessageTypes.INFO} className={Margins.bottom8}>
To receive updates on your decoration's review, join <Link
href={`https://discord.gg/${INVITE_KEY}`}
onClick={async e => {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/openInApp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default definePlugin({
{
find: "trackAnnouncementMessageLinkClicked({",
replacement: {
match: /function (\i\(\i,\i\)\{)(?=.{0,100}trusted:)/,
match: /function (\i\(\i,\i\)\{)(?=.{0,150}trusted:)/,
replace: "async function $1 if(await $self.handleLink(...arguments)) return;"
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/showHiddenThings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default definePlugin({
predicate: () => settings.store.disableDisallowedDiscoveryFilters,
all: true,
replacement: {
match: /\i\.\i\.get\(\{url:\i\.\i\.GUILD_DISCOVERY_VALID_TERM,query:\{term:\i\},oldFormErrors:!0\}\)/g,
match: /\i\.\i\.get\(\{url:\i\.\i\.GUILD_DISCOVERY_VALID_TERM,query:\{term:\i\},oldFormErrors:!0,rejectWithError:!1\}\)/g,
replace: "Promise.resolve({ body: { valid: true } })"
}
}
Expand Down

0 comments on commit a0308e0

Please sign in to comment.