From de5f28ca41afd2685c188ac247dd3aeb06a0c4bb Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Tue, 25 Jul 2023 13:06:08 +0200 Subject: [PATCH] Update PinDMs.plugin.js --- Plugins/PinDMs/PinDMs.plugin.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Plugins/PinDMs/PinDMs.plugin.js b/Plugins/PinDMs/PinDMs.plugin.js index 1b29ce1a62..b0d77018b1 100644 --- a/Plugins/PinDMs/PinDMs.plugin.js +++ b/Plugins/PinDMs/PinDMs.plugin.js @@ -261,7 +261,7 @@ module.exports = (_ => { onUserContextMenu (e) { if (e.instance.props.channel && !e.instance.props.channel.guild_id) { let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "close-dm"}); - children.splice(index > -1 ? index : children.length, 0, this.createItem(e.instance.props.channel.id)); + children.splice(index > -1 ? index : children.length, 0, this.createItem(e.instance, e.instance.props.channel.id)); } } @@ -269,12 +269,12 @@ module.exports = (_ => { if (e.instance.props.channel) { let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "change-icon", group: true}); children.splice(index > -1 ? index + 1 : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { - children: this.createItem(e.instance.props.channel.id) + children: this.createItem(e.instance, e.instance.props.channel.id) })); } } - createItem (id) { + createItem (instance, id) { if (!id) return; let pinnedInGuild = this.isPinnedInGuilds(id); @@ -314,6 +314,7 @@ module.exports = (_ => { label: category.name || this.labels.header_pinneddms, id: BDFDB.ContextMenuUtils.createItemId(this.name, "pin-channellist", category.id), action: _ => { + BDFDB.ContextMenuUtils.close(instance); if (currentCategory) this.removeFromCategory(id, currentCategory, "channelList"); this.addToCategory(id, category, "channelList"); } @@ -326,6 +327,7 @@ module.exports = (_ => { id: BDFDB.ContextMenuUtils.createItemId(this.name, pinnedInGuild ? "unpin-serverlist" : "pin-serverlist"), color: pinnedInGuild ? BDFDB.DiscordConstants.MenuItemColors.DANGER : BDFDB.DiscordConstants.MenuItemColors.DEFAULT, action: _ => { + BDFDB.ContextMenuUtils.close(instance); if (!pinnedInGuild) this.addPin(id, "guildList"); else this.removePin(id, "guildList"); }