Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(calendar): send a forwarded invitation as the message's calendar body (#9082)
gbirmand71c72db589c
diff --git a/.sqlx/query-478ecdf9dc5e832a7d7ec45ad77fc3f4adf55ac70e8b72c8ba3cecfce2f5063d.json b/.sqlx/query-4ce2488ef69065e6459d7584600761b2bf64cef0f62c7449fecf35a6ab3ecac8.jsonsimilarity index 55%rename from .sqlx/query-478ecdf9dc5e832a7d7ec45ad77fc3f4adf55ac70e8b72c8ba3cecfce2f5063d.jsonrename to .sqlx/query-4ce2488ef69065e6459d7584600761b2bf64cef0f62c7449fecf35a6ab3ecac8.jsonindex 7095532a03..68d7e3b4ed 100644--- a/.sqlx/query-478ecdf9dc5e832a7d7ec45ad77fc3f4adf55ac70e8b72c8ba3cecfce2f5063d.json+++ b/.sqlx/query-4ce2488ef69065e6459d7584600761b2bf64cef0f62c7449fecf35a6ab3ecac8.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n INSERT INTO email_attachments_drafts (\n id, draft_id, file_name, content_type, sha, size, s3_key\n )\n SELECT $1, $2, $3, $4, $5, $6, $7\n FROM email_messages m\n WHERE m.id = $2 AND m.link_id = $8\n ",+ "query": "\n INSERT INTO email_attachments_drafts (\n id, draft_id, file_name, content_type, sha, size, s3_key, content_id, is_inline\n )\n SELECT $1, $2, $3, $4, $5, $6, $7, $9, $10\n FROM email_messages m\n WHERE m.id = $2 AND m.link_id = $8\n ","describe": {"columns": [],"parameters": {@@ -12,10 +12,12 @@"Text","Int4","Text",- "Uuid"+ "Uuid",+ "Text",+ "Bool"]},"nullable": []},- "hash": "478ecdf9dc5e832a7d7ec45ad77fc3f4adf55ac70e8b72c8ba3cecfce2f5063d"+ "hash": "4ce2488ef69065e6459d7584600761b2bf64cef0f62c7449fecf35a6ab3ecac8"}diff --git a/crates/email/src/outbound/email_pg_repo/message.rs b/crates/email/src/outbound/email_pg_repo/message.rsindex 1245be10dc..3713343c08 100644--- a/crates/email/src/outbound/email_pg_repo/message.rs+++ b/crates/email/src/outbound/email_pg_repo/message.rs@@ -674,9 +674,9 @@ pub(super) async fn insert_draft_attachment(let result = sqlx::query!(r#"INSERT INTO email_attachments_drafts (- id, draft_id, file_name, content_type, sha, size, s3_key+ id, draft_id, file_name, content_type, sha, size, s3_key, content_id, is_inline)- SELECT $1, $2, $3, $4, $5, $6, $7+ SELECT $1, $2, $3, $4, $5, $6, $7, $9, $10FROM email_messages mWHERE m.id = $2 AND m.link_id = $8"#,@@ -688,6 +688,8 @@ pub(super) async fn insert_draft_attachment(attachment.size,attachment.s3_key,link_id,+ attachment.content_id,+ attachment.is_inline,).execute(&mut *tx).await?;diff --git a/crates/email/src/outbound/email_pg_repo/test/message.rs b/crates/email/src/outbound/email_pg_repo/test/message.rsindex fcf4363954..12d188d583 100644--- a/crates/email/src/outbound/email_pg_repo/test/message.rs+++ b/crates/email/src/outbound/email_pg_repo/test/message.rs@@ -945,6 +945,43 @@ async fn insert_draft_attachment_records_the_attachment_on_the_inboxs_draft(Ok(())}+#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_message"))+)]+async fn insert_draft_attachment_keeps_an_inline_part_inline(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ // An invitation's calendar body is staged inline with no Content-ID;+ // delivery reads the flag back to send it as the message's calendar part.+ use crate::domain::ports::DraftAttachmentRepo;+ let repo = EmailPgRepo::new(pool);+ let link = Uuid::parse_str("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa")?;+ let draft = Uuid::parse_str("ee000003-0000-0000-0000-000000000003")?;+ let id = Uuid::parse_str("dd000010-0000-0000-0000-000000000010")?;++ repo.delete_scheduled_messages_batch(&[draft], link).await?;+ repo.insert_draft_attachment(+ link,+ &AttachmentDraft {+ file_name: "invite.ics".to_owned(),+ content_type: "text/calendar; method=REQUEST".to_owned(),+ is_inline: true,+ ..staged_attachment(draft, id)+ },+ )+ .await?;++ let drafts = repo.draft_attachments_by_message_ids(&[draft]).await?;+ let staged = drafts[&draft]+ .iter()+ .find(|a| a.id == id)+ .expect("the staged attachment is recorded");+ assert!(staged.is_inline);+ assert_eq!(staged.content_id, None);+ Ok(())+}+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS",fixtures(path = "../../../../fixtures", scripts("email_message"))