Fix OpenInApp & ShowHiddenThings

This commit is contained in:
Nuckyz 2024-11-19 21:17:20 -03:00
parent cd61f4e744
commit a0308e03af
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
4 changed files with 11 additions and 7 deletions

View file

@ -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<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>

View file

@ -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 => {

View file

@ -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;"
}
},

View file

@ -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 } })"
}
}