Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(block-email): only show Done and Trash buttons for threads owned by the user (#2031)

Evan Hutnike1bca0ec9ffe
diff --git a/js/app/packages/block-email/component/TopBar.tsx b/js/app/packages/block-email/component/TopBar.tsx
index 5d6a5b478f..705e22eaab 100644
--- a/js/app/packages/block-email/component/TopBar.tsx
+++ b/js/app/packages/block-email/component/TopBar.tsx
@@ -28,6 +28,7 @@ import {
PROPERTIES_DRAWER_ID,
} from './EmailPropertiesModal';
import { useEmailContext } from './EmailContext';
+import { useEmailLinksQuery } from '@queries/email/link';
export function TopBar(props: {
id: string;
@@ -38,6 +39,14 @@ export function TopBar(props: {
const shareCtx = useShareDialogContext();
const emailCtx = useEmailContext();
const soup = useMaybeSoup();
+ const linksQuery = useEmailLinksQuery();
+
+ const isOwnThread = () => {
+ const thread = emailCtx.thread();
+ const links = linksQuery.data?.links;
+ if (!thread || !links) return false;
+ return links.some((link) => link.id === thread.link_id);
+ };
const trashThread = () => {
const thread = emailCtx.thread();
@@ -91,11 +100,13 @@ export function TopBar(props: {
emailCtx.archiveThread();
}
},
+ condition: isOwnThread,
},
{
label: 'Trash',
icon: TrashIcon,
action: trashThread,
+ condition: isOwnThread,
},
{
label: 'Properties',