diff --git a/Plugins/BDFDB.js b/Plugins/BDFDB.js index 0be4425436..aa58c64243 100644 --- a/Plugins/BDFDB.js +++ b/Plugins/BDFDB.js @@ -2136,7 +2136,7 @@ var BDFDB = { } if (type) LibraryModules.ContextMenuUtils.openContextMenu(e, function (e) { return BDFDB.ReactUtils.createElement(BDFDB.ModuleUtils.findByName("ChannelContextMenu"), Object.assign({}, e, { - type, + type: type, channel: channel, guild: LibraryModules.GuildStore.getGuild(channel.guild_id), selected: channel.id == LibraryModules.LastChannelStore.getChannelId() diff --git a/Plugins/PinDMs/PinDMs.plugin.js b/Plugins/PinDMs/PinDMs.plugin.js index 066235747a..b17e08f349 100644 --- a/Plugins/PinDMs/PinDMs.plugin.js +++ b/Plugins/PinDMs/PinDMs.plugin.js @@ -374,22 +374,7 @@ class PinDMs { if (e.node) { BDFDB.DOMUtils.removeClass(e.node, BDFDB.disCN._pindmsrecentpinned); e.node.removeEventListener("contextmenu", e.node.PinDMsContextMenuListener); - e.node.PinDMsContextMenuListener = event => { - let pinnedInGuild = this.isPinned(e.instance.props.channel.id, "pinnedRecents"); - BDFDB.ContextMenuUtils.open(this, event, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, { - children: [ - BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, { - label: this.labels[pinnedInGuild ? "context_unpinguild_text" : "context_pinguild_text"], - danger: pinnedInGuild, - action: event2 => { - BDFDB.ContextMenuUtils.close(event2.target); - if (!pinnedInGuild) this.addPin(e.instance.props.channel.id, "pinnedRecents"); - else this.removePin(e.instance.props.channel.id, "pinnedRecents"); - } - }) - ] - })); - }; + e.node.PinDMsContextMenuListener = event => {BDFDB.DMUtils.openMenu(e.instance.props.channel.id, event);}; e.node.addEventListener("contextmenu", e.node.PinDMsContextMenuListener); if (this.isPinned(e.instance.props.channel.id, "pinnedRecents")) { BDFDB.DOMUtils.addClass(e.node, BDFDB.disCN._pindmsrecentpinned); @@ -436,12 +421,12 @@ class PinDMs { e.node.addEventListener("mousedown", e.node.PinDMsMouseDownListener); } } - if (e.returnvalue && this.isPinned(e.instance.props.channel.id, "pinnedRecents")) { + if (this.isPinned(e.instance.props.channel.id, "pinnedRecents") && BDFDB.DataUtils.get(this, "settings", "showPinIcon")) { let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:"BlobMask"}); - if (index > -1 && !children[index].props.upperBadge && BDFDB.DataUtils.get(this, "settings", "showPinIcon")) children[index].props.upperBadge = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.BadgeComponents.IconBadge, { + if (index > -1) children[index].props.upperLeftBadge = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.BadgeComponents.IconBadge, { className: BDFDB.disCN.guildbadgeiconbadge2, name: BDFDB.LibraryComponents.SvgIcon.Names.NOVA_PIN, - style: {backgroundColor: null} + style: {backgroundColor: null, transform: "scale(-1, 1)"} }); } } diff --git a/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js b/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js index 35db7f5d28..a05fced89f 100644 --- a/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js +++ b/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js @@ -124,6 +124,19 @@ class ReadAllNotificationsButton { // begin of own functions + onUserContextMenu (e) { + if (e.instance.props.channelId && e.instance.props.type == BDFDB.DiscordConstants.ContextMenuTypes.USER_PRIVATE_CHANNELS) { + e.returnvalue.props.children.props.children.props.children.unshift(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, { + label: BDFDB.LanguageUtils.LanguageStrings.MARK_AS_READ, + disabled: !BDFDB.LibraryModules.DirectMessageUnreadStore.getUnreadPrivateChannelIds().includes(e.instance.props.channelId), + action: event => { + BDFDB.ContextMenuUtils.close(event.target); + BDFDB.DMUtils.markAsRead(e.instance.props.channelId); + } + })); + } + } + processGuilds (e) { let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "ConnectedUnreadDMs"}); if (index > -1) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement("div", {