fix: ShowConnections patch; chore: Remove dead code

This commit is contained in:
Nuckyz 2024-06-12 16:39:04 -03:00
parent 40c5ade82d
commit 0561bd1951
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
4 changed files with 6 additions and 12 deletions

View file

@ -338,7 +338,7 @@ export default definePlugin({
{
// Call our function to decide whether the embed should be ignored or not
predicate: () => settings.store.transformEmojis || settings.store.transformStickers,
match: /(renderEmbeds\((\i)\){)(.+?embeds\.map\(\(?(\i)(?:,\i\))?=>{)/,
match: /(renderEmbeds\((\i)\){)(.+?embeds\.map\(\((\i),\i\)?=>{)/,
replace: (_, rest1, message, rest2, embed) => `${rest1}const fakeNitroMessage=${message};${rest2}if($self.shouldIgnoreEmbed(${embed},fakeNitroMessage))return null;`
},
{

View file

@ -6,7 +6,7 @@
import { classNameFactory } from "@api/Styles";
import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModalLazy } from "@utils/modal";
import { extractAndLoadChunksLazy, filters, find, findComponentByCode, findComponentByCodeLazy, LazyComponentWebpack } from "@webpack";
import { extractAndLoadChunksLazy, findComponentByCodeLazy, findExportedComponentLazy } from "@webpack";
import { Button, Forms, Text, TextInput, Toasts, useEffect, useState } from "@webpack/common";
import { DEFAULT_COLOR, SWATCHES } from "../constants";
@ -31,12 +31,7 @@ interface ColorPickerWithSwatchesProps {
}
const ColorPicker = findComponentByCodeLazy<ColorPickerProps>(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)");
// FIXME: Replace with the following when it reaches stable
// const ColorPickerWithSwatches = findExportedComponentLazy<ColorPickerWithSwatchesProps>("ColorPicker", "CustomColorPicker");
const ColorPickerWithSwatches = LazyComponentWebpack<ColorPickerWithSwatchesProps>(() =>
find(filters.byProps("ColorPicker", "CustomColorPicker"), { isIndirect: true })?.ColorPicker ||
findComponentByCode("presets,", "customColor:")
);
const ColorPickerWithSwatches = findExportedComponentLazy<ColorPickerWithSwatchesProps>("ColorPicker", "CustomColorPicker");
export const requireSettingsMenu = extractAndLoadChunksLazy(['name:"UserSettings"'], /createPromise:.{0,20}Promise\.all\((\[\i\.\i\(".+?"\).+?\])\).then\(\i\.bind\(\i,"(.+?)"\)\).{0,50}"UserSettings"/);

View file

@ -210,9 +210,9 @@ export default definePlugin({
}
},
{
find: "autoFocusNote:!0})",
find: ".UserProfileTypes.BITE_SIZE,onOpenProfile",
replacement: {
match: /{autoFocusNote:!1}\)}\)(?<=user:(\i),bio:null==(\i)\?.+?)/,
match: /currentUser:\i,guild:\i,onOpenProfile:.+?}\)(?=])(?<=user:(\i),bio:null==(\i)\?.+?)/,
replace: "$&,$self.profilePopoutComponent({ user: $1, displayProfile: $2, simplified: true })"
}
}

View file

@ -73,9 +73,8 @@ export default definePlugin({
find: '"placeholder-channel-id"',
replacement: [
// Remove the special logic for channels we don't have access to
// FIXME Remove variable matcher from threadsIds when it hits stable
{
match: /if\(!\i\.\i\.can\(\i\.\i\.VIEW_CHANNEL.+?{if\(this\.id===\i\).+?threadIds:(?:\[\]|\i)}}/,
match: /if\(!\i\.\i\.can\(\i\.\i\.VIEW_CHANNEL.+?{if\(this\.id===\i\).+?threadIds:\[\]}}/,
replace: ""
},
// Do not check for unreads when selecting the render level if the channel is hidden