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(email): Show attachments of sent message during undo window (#1328)

Evan Hutnikf025d33184db
diff --git a/js/app/packages/block-email/component/MessageContainer.tsx b/js/app/packages/block-email/component/MessageContainer.tsx
index ae13ec48fc..5c6134511b 100644
--- a/js/app/packages/block-email/component/MessageContainer.tsx
+++ b/js/app/packages/block-email/component/MessageContainer.tsx
@@ -134,6 +134,10 @@ export function MessageContainer(props: MessageContainerProps) {
);
});
+ const draftAttachments = createMemo(() => {
+ return props.message.attachments_draft ?? [];
+ });
+
const { replaceOrInsertSplit } = useSplitLayout();
const entityQueryClient = useQueryClient();
@@ -287,6 +291,22 @@ export function MessageContainer(props: MessageContainerProps) {
</For>
</div>
</Show>
+
+ {/* Draft attachments. Needed to display attachments of sent messages before they actually get sent (undo window). */}
+ <Show when={draftAttachments().length > 0}>
+ <div class="flex flex-row overflow-x-scroll mt-2 gap-2">
+ <For each={draftAttachments()}>
+ {(attachment) => (
+ <EmailAttachmentPill
+ attachment={{
+ fileName: attachment.file_name,
+ mimeType: attachment.content_type,
+ }}
+ />
+ )}
+ </For>
+ </div>
+ </Show>
</Message>
<Show when={(showReply() || draftChild()) && !props.isLastMessage}>
<Message
diff --git a/rust/cloud-storage/email_db_client/src/messages/get.rs b/rust/cloud-storage/email_db_client/src/messages/get.rs
index 0d5240299d..4d5f165318 100644
--- a/rust/cloud-storage/email_db_client/src/messages/get.rs
+++ b/rust/cloud-storage/email_db_client/src/messages/get.rs
@@ -525,10 +525,12 @@ pub async fn convert_db_messages_to_service_concurrent(
.map(|m| m.id)
.collect();
- // Collect message IDs that are drafts created in Macro (no provider_id)
+ // Query for drafts and sent messages we haven't gotten a provider id from gmail for. We return
+ // draft attachments for non-drafts without provider ids so we can show the attachments on the
+ // just-sent message, before the undo delay expires and before we get the provider id from gmail.
let draft_message_ids: Vec<Uuid> = db_messages
.iter()
- .filter(|m| m.is_draft && m.provider_id.is_none())
+ .filter(|m| m.provider_id.is_none())
.map(|m| m.id)
.collect();
diff --git a/rust/cloud-storage/email_service/Cargo.toml b/rust/cloud-storage/email_service/Cargo.toml
index cf2b3d3079..f4f7a7e337 100644
--- a/rust/cloud-storage/email_service/Cargo.toml
+++ b/rust/cloud-storage/email_service/Cargo.toml
@@ -58,6 +58,7 @@ default = [
"sfs_delete",
]
gmail_webhook_auth = []
+local_auth = ["macro_middleware/local_auth"]
local_queue = []
sfs_map = []
sfs_delete = []