mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-08 22:23:02 -04:00
Fixes For HideServers
This commit is contained in:
parent
5bb6148daf
commit
c754e5d7b8
3 changed files with 9 additions and 9 deletions
|
@ -43,7 +43,7 @@ function VencordPopout(onClose: () => void) {
|
|||
>
|
||||
{Object.entries(plugin.toolboxActions).map(([text, action]) => {
|
||||
const key = `vc-toolbox-${plugin.name}-${text}`;
|
||||
|
||||
|
||||
if (plugin.name === "Demonstration") {
|
||||
const [demonstrationToggled, setToggled] = useState(false);
|
||||
|
||||
|
@ -54,9 +54,9 @@ function VencordPopout(onClose: () => void) {
|
|||
checked={!!demonstrationToggled}
|
||||
label={text}
|
||||
action={
|
||||
() => {
|
||||
action();
|
||||
setToggled(!demonstrationToggled);
|
||||
() => {
|
||||
action();
|
||||
setToggled(!demonstrationToggled);
|
||||
}
|
||||
}
|
||||
/>
|
||||
|
|
|
@ -77,8 +77,8 @@ export default definePlugin({
|
|||
find: '("guildsnav")',
|
||||
replacement: [
|
||||
{
|
||||
match: /(?<=#{intl::SERVERS}\),children:)(\i)(\)?\.map\(\i\))/g,
|
||||
replace: "$self.useFilteredGuilds($1)$2",
|
||||
match: /(?<=#{intl::SERVERS}\),children:)(\i)/g,
|
||||
replace: "$self.useFilteredGuilds($1)",
|
||||
},
|
||||
// despite my best efforts, the above doesnt trigger a rerender
|
||||
{
|
||||
|
@ -113,6 +113,7 @@ export default definePlugin({
|
|||
useFilteredGuilds(guilds: guildsNode[]): guildsNode[] {
|
||||
const hiddenGuilds = useStateFromStores([HiddenServersStore], () => HiddenServersStore.hiddenGuilds, undefined, (old, newer) => old.size === newer.size);
|
||||
return guilds.flatMap(guild => {
|
||||
if (!(hiddenGuilds instanceof Set)) return [guild];
|
||||
if (hiddenGuilds.has(guild.id.toString())) {
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ export default definePlugin({
|
|||
|
||||
if (!msg.attachments.length && !msg.embeds.length && !msg.stickerItems.length && !hasAttachmentsInShapshots) return null;
|
||||
|
||||
const isHidden = hiddenMessages?.has(msg.id) || false;
|
||||
const isHidden = hiddenMessages instanceof Set ? hiddenMessages.has(msg.id) : false;
|
||||
|
||||
return {
|
||||
label: isHidden ? "Show Media" : "Hide Media",
|
||||
|
@ -93,8 +93,7 @@ export default definePlugin({
|
|||
},
|
||||
|
||||
shouldHide(messageId: string) {
|
||||
return hiddenMessages.has(messageId) || false;
|
||||
|
||||
return hiddenMessages instanceof Set ? hiddenMessages.has(messageId) : false;
|
||||
},
|
||||
|
||||
async toggleHide(channelId: string, messageId: string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue