Fix OpenInApp & ShowHiddenThings
This commit is contained in:
parent
cd61f4e744
commit
a0308e03af
4 changed files with 11 additions and 7 deletions
|
@ -10,6 +10,7 @@ import { openInviteModal } from "@utils/discord";
|
||||||
import { Margins } from "@utils/margins";
|
import { Margins } from "@utils/margins";
|
||||||
import { classes, copyWithToast } from "@utils/misc";
|
import { classes, copyWithToast } from "@utils/misc";
|
||||||
import { closeAllModals, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
|
import { closeAllModals, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
|
||||||
|
import { Queue } from "@utils/Queue";
|
||||||
import { findComponentByCodeLazy } from "@webpack";
|
import { findComponentByCodeLazy } from "@webpack";
|
||||||
import { Alerts, Button, FluxDispatcher, Forms, GuildStore, NavigationRouter, Parser, Text, Tooltip, useEffect, UserStore, UserUtils, useState } from "@webpack/common";
|
import { Alerts, Button, FluxDispatcher, Forms, GuildStore, NavigationRouter, Parser, Text, Tooltip, useEffect, UserStore, UserUtils, useState } from "@webpack/common";
|
||||||
import { User } from "discord-types/general";
|
import { User } from "discord-types/general";
|
||||||
|
@ -49,6 +50,8 @@ interface SectionHeaderProps {
|
||||||
section: Section;
|
section: Section;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fetchAuthorsQueue = new Queue();
|
||||||
|
|
||||||
function SectionHeader({ section }: SectionHeaderProps) {
|
function SectionHeader({ section }: SectionHeaderProps) {
|
||||||
const hasSubtitle = typeof section.subtitle !== "undefined";
|
const hasSubtitle = typeof section.subtitle !== "undefined";
|
||||||
const hasAuthorIds = typeof section.authorIds !== "undefined";
|
const hasAuthorIds = typeof section.authorIds !== "undefined";
|
||||||
|
@ -56,17 +59,18 @@ function SectionHeader({ section }: SectionHeaderProps) {
|
||||||
const [authors, setAuthors] = useState<User[]>([]);
|
const [authors, setAuthors] = useState<User[]>([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
fetchAuthorsQueue.push(async () => {
|
||||||
if (!section.authorIds) return;
|
if (!section.authorIds) return;
|
||||||
|
|
||||||
for (const authorId of section.authorIds) {
|
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]);
|
setAuthors(authors => [...authors, author]);
|
||||||
}
|
}
|
||||||
})();
|
});
|
||||||
}, [section.authorIds]);
|
}, [section.authorIds]);
|
||||||
|
|
||||||
|
|
||||||
return <div>
|
return <div>
|
||||||
<Flex>
|
<Flex>
|
||||||
<Forms.FormTitle style={{ flexGrow: 1 }}>{section.title}</Forms.FormTitle>
|
<Forms.FormTitle style={{ flexGrow: 1 }}>{section.title}</Forms.FormTitle>
|
||||||
|
|
|
@ -119,7 +119,7 @@ function CreateDecorationModal(props: ModalProps) {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<HelpMessage messageType={HelpMessageTypes.INFO}>
|
<HelpMessage messageType={HelpMessageTypes.INFO} className={Margins.bottom8}>
|
||||||
To receive updates on your decoration's review, join <Link
|
To receive updates on your decoration's review, join <Link
|
||||||
href={`https://discord.gg/${INVITE_KEY}`}
|
href={`https://discord.gg/${INVITE_KEY}`}
|
||||||
onClick={async e => {
|
onClick={async e => {
|
||||||
|
|
|
@ -87,7 +87,7 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: "trackAnnouncementMessageLinkClicked({",
|
find: "trackAnnouncementMessageLinkClicked({",
|
||||||
replacement: {
|
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;"
|
replace: "async function $1 if(await $self.handleLink(...arguments)) return;"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -107,7 +107,7 @@ export default definePlugin({
|
||||||
predicate: () => settings.store.disableDisallowedDiscoveryFilters,
|
predicate: () => settings.store.disableDisallowedDiscoveryFilters,
|
||||||
all: true,
|
all: true,
|
||||||
replacement: {
|
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 } })"
|
replace: "Promise.resolve({ body: { valid: true } })"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue