From a0308e03affd9345fe8774e528113ca280725d0e Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Tue, 19 Nov 2024 21:17:20 -0300 Subject: [PATCH] Fix OpenInApp & ShowHiddenThings --- .../decor/ui/modals/ChangeDecorationModal.tsx | 12 ++++++++---- .../decor/ui/modals/CreateDecorationModal.tsx | 2 +- src/plugins/openInApp/index.ts | 2 +- src/plugins/showHiddenThings/index.ts | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/plugins/decor/ui/modals/ChangeDecorationModal.tsx b/src/plugins/decor/ui/modals/ChangeDecorationModal.tsx index 6501e0fe..a3edc097 100644 --- a/src/plugins/decor/ui/modals/ChangeDecorationModal.tsx +++ b/src/plugins/decor/ui/modals/ChangeDecorationModal.tsx @@ -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"; @@ -49,6 +50,8 @@ interface SectionHeaderProps { section: Section; } +const fetchAuthorsQueue = new Queue(); + function SectionHeader({ section }: SectionHeaderProps) { const hasSubtitle = typeof section.subtitle !== "undefined"; const hasAuthorIds = typeof section.authorIds !== "undefined"; @@ -56,17 +59,18 @@ function SectionHeader({ section }: SectionHeaderProps) { const [authors, setAuthors] = useState([]); 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
{section.title} diff --git a/src/plugins/decor/ui/modals/CreateDecorationModal.tsx b/src/plugins/decor/ui/modals/CreateDecorationModal.tsx index 57a39540..eb39c16d 100644 --- a/src/plugins/decor/ui/modals/CreateDecorationModal.tsx +++ b/src/plugins/decor/ui/modals/CreateDecorationModal.tsx @@ -119,7 +119,7 @@ function CreateDecorationModal(props: ModalProps) { />
- + To receive updates on your decoration's review, join { diff --git a/src/plugins/openInApp/index.ts b/src/plugins/openInApp/index.ts index 1e4f3041..2d27c2b2 100644 --- a/src/plugins/openInApp/index.ts +++ b/src/plugins/openInApp/index.ts @@ -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;" } }, diff --git a/src/plugins/showHiddenThings/index.ts b/src/plugins/showHiddenThings/index.ts index 8fd6ef82..9f6fd2a9 100644 --- a/src/plugins/showHiddenThings/index.ts +++ b/src/plugins/showHiddenThings/index.ts @@ -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 } })" } }