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(email): Don't create user_history row for auto-inserted attachments (#1346)
Evan Hutnika682d5b4c11c
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/createDocumentRequest.ts b/js/app/packages/service-clients/service-storage/generated/schemas/createDocumentRequest.tsindex 1b562680fe..d9c0299a7d 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/createDocumentRequest.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/createDocumentRequest.ts@@ -45,4 +45,6 @@ Will need to have a corresponding job initiated for the file beforehand. */projectId?: CreateDocumentRequestProjectId;/** The sha of the document. */sha: string;+ /** Whether to add a viewed_at record for this document upon creation. */+ skipHistory?: boolean;}diff --git a/js/app/packages/service-clients/service-storage/generated/zod.ts b/js/app/packages/service-clients/service-storage/generated/zod.tsindex eff1ae37b4..a8d464920f 100644--- a/js/app/packages/service-clients/service-storage/generated/zod.ts+++ b/js/app/packages/service-clients/service-storage/generated/zod.ts@@ -984,6 +984,12 @@ export const createDocumentHandlerBody = zod.object({),projectId: zod.string().nullish(),sha: zod.string().describe('The sha of the document.'),+ skipHistory: zod+ .boolean()+ .optional()+ .describe(+ 'Whether to add a viewed_at record for this document upon creation.'+ ),});export const createDocumentHandlerResponse = zod.object({diff --git a/js/app/packages/service-clients/service-storage/openapi.json b/js/app/packages/service-clients/service-storage/openapi.jsonindex 88d692149b..ed18272508 100644--- a/js/app/packages/service-clients/service-storage/openapi.json+++ b/js/app/packages/service-clients/service-storage/openapi.json@@ -5136,6 +5136,10 @@"sha": {"type": "string","description": "The sha of the document."+ },+ "skipHistory": {+ "type": "boolean",+ "description": "Whether to add a viewed_at record for this document upon creation."}}},diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/create_document/create_document_handler.rs b/rust/cloud-storage/document_storage_service/src/api/documents/create_document/create_document_handler.rsindex a4d52f687d..3c70df9abc 100644--- a/rust/cloud-storage/document_storage_service/src/api/documents/create_document/create_document_handler.rs+++ b/rust/cloud-storage/document_storage_service/src/api/documents/create_document/create_document_handler.rs@@ -94,6 +94,7 @@ pub(in crate::api) async fn create_document_handler(email_attachment_id: req.email_attachment_id,created_at: req.created_at.as_ref(),is_task: req.is_task,+ skip_history: req.skip_history,},).await;diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/create_document/create_document_v2.rs b/rust/cloud-storage/document_storage_service/src/api/documents/create_document/create_document_v2.rsindex 4820a8c4d8..1a38de4cec 100644--- a/rust/cloud-storage/document_storage_service/src/api/documents/create_document/create_document_v2.rs+++ b/rust/cloud-storage/document_storage_service/src/api/documents/create_document/create_document_v2.rs@@ -23,6 +23,7 @@ pub struct CreateDocumentParams<'a> {pub email_attachment_id: Option<Uuid>,pub created_at: Option<&'a DateTime<Utc>>,pub is_task: bool,+ pub skip_history: bool,}/// Creates a document in the database@@ -45,6 +46,7 @@ pub async fn create_document(email_attachment_id,created_at,is_task,+ skip_history,} = params;let owner = owner.into_owned();@@ -65,7 +67,7 @@ pub async fn create_document(project_id,project_name: None,share_permission: &share_permission,- skip_history: false,+ skip_history,email_attachment_id,created_at,is_task,diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/create_task.rs b/rust/cloud-storage/document_storage_service/src/api/documents/create_task.rsindex 3f96d02f2f..4e9a4aafbf 100644--- a/rust/cloud-storage/document_storage_service/src/api/documents/create_task.rs+++ b/rust/cloud-storage/document_storage_service/src/api/documents/create_task.rs@@ -95,6 +95,7 @@ pub(in crate::api) async fn create_task_handler(email_attachment_id: None,created_at: None,is_task: true,+ skip_history: false,},).await;diff --git a/rust/cloud-storage/email_service/src/bin/backfill_gmail_attachments/upload.rs b/rust/cloud-storage/email_service/src/bin/backfill_gmail_attachments/upload.rsindex 316b7a21c3..b55ea32c9e 100644--- a/rust/cloud-storage/email_service/src/bin/backfill_gmail_attachments/upload.rs+++ b/rust/cloud-storage/email_service/src/bin/backfill_gmail_attachments/upload.rs@@ -135,6 +135,7 @@ impl AttachmentProcessor {created_at: Some(attachment.internal_date_ts),email_attachment_id: Some(attachment.attachment_db_id),is_task: false,+ skip_history: true,},&self.macro_id_destination,)diff --git a/rust/cloud-storage/email_service/src/util/upload_attachment.rs b/rust/cloud-storage/email_service/src/util/upload_attachment.rsindex 8cd91959e8..90859bc1f0 100644--- a/rust/cloud-storage/email_service/src/util/upload_attachment.rs+++ b/rust/cloud-storage/email_service/src/util/upload_attachment.rs@@ -289,6 +289,7 @@ async fn create_dss_document_record(created_at,email_attachment_id: Some(p.attachment_db_id),is_task: false,+ skip_history: true,};dss_clientdiff --git a/rust/cloud-storage/model/src/document/response/mod.rs b/rust/cloud-storage/model/src/document/response/mod.rsindex 481566fbf2..62843793d8 100644--- a/rust/cloud-storage/model/src/document/response/mod.rs+++ b/rust/cloud-storage/model/src/document/response/mod.rs@@ -230,4 +230,7 @@ pub struct CreateDocumentRequest {/// md.#[serde(default)]pub is_task: bool,+ /// Whether to add a viewed_at record for this document upon creation.+ #[serde(default)]+ pub skip_history: bool,}