From 6300198a5463ab38da81906bda634addf4c8a369 Mon Sep 17 00:00:00 2001
From: V <vendicated@riseup.net>
Date: Sun, 28 May 2023 21:59:22 +0200
Subject: MessageLinkEmbeds: Fix niche unclaimed account bug

This plugin fires MESSAGE_UPDATE events for messages containing message
links (to rerender them). If the updated message is an interaction, it
contains message.interaction.user. If the one who ran the command is
you, message.interaction.user will be you and the email in this data is
always set to null. Discord seems to update the local user data with
this user. So essentially, in the above described edge case it would
update the current user to have no email (only locally, in memory. There
is 0 risk for your account, it was just a temporary visual bug) which
would cause the unclaimed account banner to appear.

This commit fixes this by simply omitting the interaction field from the
MESSAGE_UPDATE event
---
 src/plugins/messageLinkEmbeds.tsx | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'src/plugins/messageLinkEmbeds.tsx')

diff --git a/src/plugins/messageLinkEmbeds.tsx b/src/plugins/messageLinkEmbeds.tsx
index d1fcbf3..5fae234 100644
--- a/src/plugins/messageLinkEmbeds.tsx
+++ b/src/plugins/messageLinkEmbeds.tsx
@@ -225,6 +225,8 @@ function MessageEmbedAccessory({ message }: { message: Message; }) {
             } else {
                 const msg = { ...message } as any;
                 delete msg.embeds;
+                delete msg.interaction;
+
                 messageFetchQueue.push(() => fetchMessage(channelID, messageID)
                     .then(m => m && FluxDispatcher.dispatch({
                         type: "MESSAGE_UPDATE",
-- 
cgit 

