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
This commit is contained in:
parent
458c7ed4c5
commit
6300198a54
2 changed files with 3 additions and 7 deletions
|
@ -20,7 +20,7 @@ import { get, set } from "@api/DataStore";
|
||||||
import { addButton, removeButton } from "@api/MessagePopover";
|
import { addButton, removeButton } from "@api/MessagePopover";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
import { ChannelStore, FluxDispatcher } from "@webpack/common";
|
import { ChannelStore } from "@webpack/common";
|
||||||
|
|
||||||
let style: HTMLStyleElement;
|
let style: HTMLStyleElement;
|
||||||
|
|
||||||
|
@ -101,11 +101,5 @@ export default definePlugin({
|
||||||
|
|
||||||
await saveHiddenMessages(ids);
|
await saveHiddenMessages(ids);
|
||||||
await this.buildCss();
|
await this.buildCss();
|
||||||
|
|
||||||
// update is necessary to rerender the PopOver
|
|
||||||
FluxDispatcher.dispatch({
|
|
||||||
type: "MESSAGE_UPDATE",
|
|
||||||
message: { id }
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -225,6 +225,8 @@ function MessageEmbedAccessory({ message }: { message: Message; }) {
|
||||||
} else {
|
} else {
|
||||||
const msg = { ...message } as any;
|
const msg = { ...message } as any;
|
||||||
delete msg.embeds;
|
delete msg.embeds;
|
||||||
|
delete msg.interaction;
|
||||||
|
|
||||||
messageFetchQueue.push(() => fetchMessage(channelID, messageID)
|
messageFetchQueue.push(() => fetchMessage(channelID, messageID)
|
||||||
.then(m => m && FluxDispatcher.dispatch({
|
.then(m => m && FluxDispatcher.dispatch({
|
||||||
type: "MESSAGE_UPDATE",
|
type: "MESSAGE_UPDATE",
|
||||||
|
|
Loading…
Reference in a new issue