1
0
Fork 1
mirror of https://github.com/Vendicated/Vencord.git synced 2025-01-10 09:56:24 +00:00

Fix including mentions

This commit is contained in:
Nuckyz 2024-11-25 19:38:58 -03:00
parent 7a9a85a2e0
commit 032e4e2531
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
2 changed files with 22 additions and 16 deletions

View file

@ -18,7 +18,7 @@
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack"; import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack";
import { useStateFromStores } from "@webpack/common"; import { React, useStateFromStores } from "@webpack/common";
import type { CSSProperties } from "react"; import type { CSSProperties } from "react";
import { ExpandedGuildFolderStore, settings } from "."; import { ExpandedGuildFolderStore, settings } from ".";

View file

@ -123,12 +123,12 @@ export default definePlugin({
}, },
// If we are rendering the Better Folders sidebar, we filter out everything but the servers and folders from the GuildsBar Guild List children // If we are rendering the Better Folders sidebar, we filter out everything but the servers and folders from the GuildsBar Guild List children
{ {
match: /lastTargetNode:\i\[\i\.length-1\].+?Fragment.+?null.+?}\)\]/, match: /lastTargetNode:\i\[\i\.length-1\].+?}\)\](?=}\))/,
replace: "$&.filter($self.makeGuildsBarGuildListFilter(!!arguments[0]?.isBetterFolders))" replace: "$&.filter($self.makeGuildsBarGuildListFilter(!!arguments[0]?.isBetterFolders))"
}, },
// If we are rendering the Better Folders sidebar, we filter out everything but the scroller for the guild list from the GuildsBar Tree children // If we are rendering the Better Folders sidebar, we filter out everything but the scroller for the guild list from the GuildsBar Tree children
{ {
match: /fixedDiscoveryIcon.+?}\)\]/, match: /unreadMentionsIndicatorBottom.+?}\)\]/,
replace: "$&.filter($self.makeGuildsBarTreeFilter(!!arguments[0]?.isBetterFolders))" replace: "$&.filter($self.makeGuildsBarTreeFilter(!!arguments[0]?.isBetterFolders))"
}, },
// Export the isBetterFolders variable to the folders component // Export the isBetterFolders variable to the folders component
@ -276,23 +276,29 @@ export default definePlugin({
makeGuildsBarGuildListFilter(isBetterFolders: boolean) { makeGuildsBarGuildListFilter(isBetterFolders: boolean) {
return child => { return child => {
if (isBetterFolders) { if (!isBetterFolders) return true;
try { try {
return child?.props?.["aria-label"] === getIntlMessage("SERVERS"); return child?.props?.["aria-label"] === getIntlMessage("SERVERS");
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }
}
return true; return true;
}; };
}, },
makeGuildsBarTreeFilter(isBetterFolders: boolean) { makeGuildsBarTreeFilter(isBetterFolders: boolean) {
return child => { return child => {
if (isBetterFolders) { if (!isBetterFolders) return true;
return child?.props?.onScroll != null;
} if (child?.props?.className?.includes("itemsContainer")) {
// Filter out everything but the scroller for the guild list
child.props.children = child.props.children.filter(child => child?.props?.onScroll != null);
return true; return true;
}
return false;
}; };
}, },