diff --git a/src/plugins/UnsuppressEmbeds.tsx b/src/plugins/unsuppressEmbeds.tsx similarity index 56% rename from src/plugins/UnsuppressEmbeds.tsx rename to src/plugins/unsuppressEmbeds.tsx index 99735c73..a2196077 100644 --- a/src/plugins/UnsuppressEmbeds.tsx +++ b/src/plugins/unsuppressEmbeds.tsx @@ -24,34 +24,32 @@ import { Menu, PermissionsBits, PermissionStore, RestAPI, UserStore } from "@web const EMBED_SUPPRESSED = 1 << 2; -const messageContextMenuPatch: NavContextMenuPatchCallback = (children, props) => { - const { message: { author, embeds, flags } } = props; - +const messageContextMenuPatch: NavContextMenuPatchCallback = (children, { channel, message: { author, embeds, flags, id: messageId } }) => () => { const isEmbedSuppressed = (flags & EMBED_SUPPRESSED) !== 0; - const hasEmbedPerms = !!(PermissionStore.getChannelPermissions({ id: props.channel.id }) & PermissionsBits.EMBED_LINKS); + if (!isEmbedSuppressed && !embeds.length) return; - return () => { - if (!isEmbedSuppressed && !embeds.length) return; - if (author.id === UserStore.getCurrentUser().id && !hasEmbedPerms) return; - const menuGroup = findGroupChildrenByChildId("delete", children); - const deleteItem = menuGroup?.findIndex(i => i?.props?.id === "delete"); - if (!deleteItem || !menuGroup) return; - menuGroup.splice(deleteItem - 1, 0, ( -