From 608a67c9ae4eea61bc532398ed615a4984db2ffc Mon Sep 17 00:00:00 2001 From: V Date: Tue, 26 Sep 2023 03:54:59 +0200 Subject: [PATCH] fix quick/searchReply & MessageClickactions not working in dms --- src/plugins/messageClickActions/index.ts | 2 +- src/plugins/quickReply/index.ts | 6 ++++-- src/plugins/searchReply/index.tsx | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/messageClickActions/index.ts b/src/plugins/messageClickActions/index.ts index 128cb7c16..08cee4c9f 100644 --- a/src/plugins/messageClickActions/index.ts +++ b/src/plugins/messageClickActions/index.ts @@ -71,7 +71,7 @@ export default definePlugin({ if (!isDeletePressed) { if (event.detail < 2) return; if (settings.store.requireModifier && !event.ctrlKey && !event.shiftKey) return; - if (!PermissionStore.can(PermissionsBits.SEND_MESSAGES, channel)) return; + if (channel.guild_id && !PermissionStore.can(PermissionsBits.SEND_MESSAGES, channel)) return; if (isMe) { if (!settings.store.enableDoubleClickToEdit || EditStore.isEditing(channel.id, msg.id)) return; diff --git a/src/plugins/quickReply/index.ts b/src/plugins/quickReply/index.ts index 7a39ec07e..118a51beb 100644 --- a/src/plugins/quickReply/index.ts +++ b/src/plugins/quickReply/index.ts @@ -172,7 +172,8 @@ function shouldMention(message) { // handle next/prev reply function nextReply(isUp: boolean) { - if (!PermissionStore.can(PermissionsBits.SEND_MESSAGES, ChannelStore.getChannel(SelectedChannelStore.getChannelId()))) return; + const currChannel = ChannelStore.getChannel(SelectedChannelStore.getChannelId()); + if (currChannel.guild_id && !PermissionStore.can(PermissionsBits.SEND_MESSAGES, currChannel)) return; const message = getNextMessage(isUp, true); if (!message) @@ -196,7 +197,8 @@ function nextReply(isUp: boolean) { // handle next/prev edit function nextEdit(isUp: boolean) { - if (!PermissionStore.can(PermissionsBits.SEND_MESSAGES, ChannelStore.getChannel(SelectedChannelStore.getChannelId()))) return; + const currChannel = ChannelStore.getChannel(SelectedChannelStore.getChannelId()); + if (currChannel.guild_id && !PermissionStore.can(PermissionsBits.SEND_MESSAGES, currChannel)) return; const message = getNextMessage(isUp, false); if (!message) diff --git a/src/plugins/searchReply/index.tsx b/src/plugins/searchReply/index.tsx index 98f26e08e..b28ca8ec4 100644 --- a/src/plugins/searchReply/index.tsx +++ b/src/plugins/searchReply/index.tsx @@ -32,7 +32,7 @@ const messageContextMenuPatch: NavContextMenuPatchCallback = (children, { messag if (SelectedChannelStore.getChannelId() !== message.channel_id) return; const channel = ChannelStore.getChannel(message?.channel_id); if (!channel) return; - if (!PermissionStore.can(PermissionsBits.SEND_MESSAGES, channel)) return; + if (channel.guild_id && !PermissionStore.can(PermissionsBits.SEND_MESSAGES, channel)) return; // dms and group chats const dmGroup = findGroupChildrenByChildId("pin", children);