aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-09-07 21:43:48 +0200
committerVendicated <vendicated@riseup.net>2022-09-07 21:43:48 +0200
commit4f531b36344390365adc2ddbf0bffec90b8303b7 (patch)
treef101f2edaa0db09b7e1e6d99eb85c075f3d323aa /src
parenta72dedb9aabe12978527bbc346089f12dfe848ee (diff)
downloadVencord-4f531b36344390365adc2ddbf0bffec90b8303b7.tar.gz
Vencord-4f531b36344390365adc2ddbf0bffec90b8303b7.tar.bz2
Vencord-4f531b36344390365adc2ddbf0bffec90b8303b7.zip
MessageActions: ignore dblclicks if already editing the msg
Diffstat (limited to 'src')
-rw-r--r--src/plugins/messageActions.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/messageActions.ts b/src/plugins/messageActions.ts
index 10969f9..2972cbc 100644
--- a/src/plugins/messageActions.ts
+++ b/src/plugins/messageActions.ts
@@ -1,6 +1,7 @@
import { addClickListener, removeClickListener } from '../api/MessageEvents';
import definePlugin from "../utils/types";
import { find, findByProps } from "../webpack";
+import { UserStore } from "../webpack/common";
let isDeletePressed = false;
const keydown = (e: KeyboardEvent) => e.key === "Backspace" && (isDeletePressed = true);
@@ -16,15 +17,15 @@ export default definePlugin({
const { deleteMessage, startEditMessage } = findByProps("deleteMessage");
const { can } = findByProps("can", "initialize");
const { Permissions: { MANAGE_MESSAGES } } = find(m => m.Permissions?.MANAGE_MESSAGES);
- const { getCurrentUser } = findByProps("getCurrentUser");
+ const { isEditing } = findByProps("isEditing");
document.addEventListener("keydown", keydown);
document.addEventListener("keyup", keyup);
this.onClick = addClickListener((msg, chan, event) => {
- const isMe = msg.author.id === getCurrentUser().id;
+ const isMe = msg.author.id === UserStore.getCurrentUser().id;
if (!isDeletePressed) {
- if (isMe && event.detail >= 2) {
+ if (isMe && event.detail >= 2 && !isEditing(chan.id, msg.id)) {
startEditMessage(chan.id, msg.id, msg.content);
event.preventDefault();
}