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
feat(email): turn read receipts on by default (#9443)
gbirman2e8e461c03dd
diff --git a/.sqlx/query-163fa0170324c974aacef9994a92701fde037a3113321ce78d29804e1276c167.json b/.sqlx/query-82aea37c9a4fd4c1bc0e46657af2e587ea7eacfb69cdf935a2bfc0d0a56b420f.jsonsimilarity index 57%rename from .sqlx/query-163fa0170324c974aacef9994a92701fde037a3113321ce78d29804e1276c167.jsonrename to .sqlx/query-82aea37c9a4fd4c1bc0e46657af2e587ea7eacfb69cdf935a2bfc0d0a56b420f.jsonindex d2cef23115..7d90aa108b 100644--- a/.sqlx/query-163fa0170324c974aacef9994a92701fde037a3113321ce78d29804e1276c167.json+++ b/.sqlx/query-82aea37c9a4fd4c1bc0e46657af2e587ea7eacfb69cdf935a2bfc0d0a56b420f.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n INSERT INTO email_settings (link_id, signature_on_replies_forwards, signature, read_receipts_enabled)\n VALUES ($1, COALESCE($2, FALSE), $3, COALESCE($4, FALSE))\n ON CONFLICT (link_id)\n DO UPDATE SET\n signature_on_replies_forwards = COALESCE($2, email_settings.signature_on_replies_forwards),\n signature = COALESCE($3, email_settings.signature),\n read_receipts_enabled = COALESCE($4, email_settings.read_receipts_enabled),\n updated_at = NOW()\n RETURNING link_id, signature_on_replies_forwards, signature, read_receipts_enabled\n ",+ "query": "\n INSERT INTO email_settings (link_id, signature_on_replies_forwards, signature, read_receipts_enabled)\n VALUES ($1, COALESCE($2, FALSE), $3, COALESCE($4, TRUE))\n ON CONFLICT (link_id)\n DO UPDATE SET\n signature_on_replies_forwards = COALESCE($2, email_settings.signature_on_replies_forwards),\n signature = COALESCE($3, email_settings.signature),\n read_receipts_enabled = COALESCE($4, email_settings.read_receipts_enabled),\n updated_at = NOW()\n RETURNING link_id, signature_on_replies_forwards, signature, read_receipts_enabled\n ","describe": {"columns": [{@@ -39,5 +39,5 @@false]},- "hash": "163fa0170324c974aacef9994a92701fde037a3113321ce78d29804e1276c167"+ "hash": "82aea37c9a4fd4c1bc0e46657af2e587ea7eacfb69cdf935a2bfc0d0a56b420f"}diff --git a/apps/web/src/features/email-thread/read-receipts.ts b/apps/web/src/features/email-thread/read-receipts.tsindex dd0e43ad59..810bc1c0fc 100644--- a/apps/web/src/features/email-thread/read-receipts.ts+++ b/apps/web/src/features/email-thread/read-receipts.ts@@ -15,7 +15,9 @@ export function createThreadReadReceipts(threadId: Accessor<string>) {const tracking = () =>flag().enabled &&queryReadyGate(links) &&- links.data.links.some((link) => link.settings.read_receipts_enabled);+ links.data.links.some(+ (link) => link.settings.read_receipts_enabled ?? true+ );const query = useThreadReadReceiptsQuery(threadId, tracking);return (message: EmailMessage): ReadReceipt | undefined => {if (!tracking() || !queryReadyGate(query)) return undefined;diff --git a/apps/web/src/features/settings/email-settings.tsx b/apps/web/src/features/settings/email-settings.tsxindex 4275197c17..c5602c39f2 100644--- a/apps/web/src/features/settings/email-settings.tsx+++ b/apps/web/src/features/settings/email-settings.tsx@@ -65,7 +65,7 @@ export function EmailSettings() {<Show when={readReceipts().enabled}><SettingsSectiontitle="Read receipts"- description="See when recipients open messages you send. Macro adds an invisible image to each message, so opens are approximate: some mail apps load images automatically and others block them. Only people with access to the inbox see its opens."+ description="See when recipients open messages you send."><Suspensefallback={@@ -226,7 +226,7 @@ function ReadReceiptsRow(props: { link: EmailLink }) {size="md"label={`Read receipts for ${props.link.email_address}`}labelClass="sr-only"- checked={props.link.settings.read_receipts_enabled ?? false}+ checked={props.link.settings.read_receipts_enabled ?? true}disabled={updateSettings.isPending}onChange={(checked) =>updateSettings.mutate(diff --git a/crates/email/src/domain/read_receipts.rs b/crates/email/src/domain/read_receipts.rsindex f336950ea6..1487d203a5 100644--- a/crates/email/src/domain/read_receipts.rs+++ b/crates/email/src/domain/read_receipts.rs@@ -1,4 +1,4 @@-//! Sender-opted-in open tracking: a per-message pixel added at provider delivery.+//! Per-inbox open tracking, on by default: a per-message pixel added at provider delivery.//!//! Opens are approximate. Image proxies and privacy features fetch pixels on//! delivery, and clients that block images never fetch them.@@ -109,7 +109,7 @@ impl From<Report> for ReadReceiptError {/// Persisted facts for open tracking.pub trait ReadReceiptRepository: Send + Sync + 'static {- /// Whether the inbox opted in; a missing settings row means no.+ /// Whether the inbox has tracking on; a missing settings row means yes.fn tracking_enabled(&self, link_id: Uuid) -> impl Future<Output = Result<bool, Report>> + Send;/// Store `candidate` unless the message already has a token; return the stored token.fn message_token(@@ -154,7 +154,7 @@ impl<R: ReadReceiptRepository> ReadReceiptService<R> {/// The HTML body to hand the provider. Macro pixels quoted from earlier/// messages are always removed so a reply never reports opens of its- /// ancestors. When the inbox opted in, this message's pixel is appended.+ /// ancestors. When the inbox has tracking on, this message's pixel is appended./// Plain-text-only messages are not tracked, and tracking failures never/// block delivery.#[tracing::instrument(skip(self, html), fields(tracked = tracing::field::Empty))]diff --git a/crates/email/src/outbound/read_receipts_pg.rs b/crates/email/src/outbound/read_receipts_pg.rsindex 5303bd5232..8159723241 100644--- a/crates/email/src/outbound/read_receipts_pg.rs+++ b/crates/email/src/outbound/read_receipts_pg.rs@@ -22,7 +22,7 @@ impl ReadReceiptRepository for ReadReceiptPgRepository {).fetch_optional(&self.0).await?- .unwrap_or(false))+ .unwrap_or(true))}#[tracing::instrument(skip(self, candidate), err)]diff --git a/crates/email/src/outbound/read_receipts_pg/test.rs b/crates/email/src/outbound/read_receipts_pg/test.rsindex 0bcbe3e841..4deba49858 100644--- a/crates/email/src/outbound/read_receipts_pg/test.rs+++ b/crates/email/src/outbound/read_receipts_pg/test.rs@@ -30,10 +30,18 @@ async fn stored_receipt(pool: &PgPool, message: &str) -> (i32, Option<DateTime<U)]async fn tracking_follows_the_inbox_setting(pool: Pool<Postgres>) -> Result<(), Report> {let repo = ReadReceiptPgRepository(pool.clone());+ assert!(repo.tracking_enabled(id(LINK)).await?);++ sqlx::query!(+ "INSERT INTO email_settings (link_id, read_receipts_enabled) VALUES ($1, FALSE)",+ id(LINK)+ )+ .execute(&pool)+ .await?;assert!(!repo.tracking_enabled(id(LINK)).await?);sqlx::query!(- "INSERT INTO email_settings (link_id, read_receipts_enabled) VALUES ($1, TRUE)",+ "UPDATE email_settings SET read_receipts_enabled = TRUE WHERE link_id = $1",id(LINK)).execute(&pool)diff --git a/crates/email_db_client/src/links/get.rs b/crates/email_db_client/src/links/get.rsindex 2640789e97..8835d63546 100644--- a/crates/email_db_client/src/links/get.rs+++ b/crates/email_db_client/src/links/get.rs@@ -286,10 +286,11 @@ pub async fn fetch_inbox_details_for_macro_id(.map(|row| {let settings = service::settings::Settings {link_id: row.id,- // Missing settings row → schema default (FALSE).+ // Missing settings row → schema defaults: replies/forwards off,+ // read receipts on.signature_on_replies_forwards: row.signature_on_replies_forwards.unwrap_or(false),signature: row.signature,- read_receipts_enabled: row.read_receipts_enabled.unwrap_or(false),+ read_receipts_enabled: row.read_receipts_enabled.unwrap_or(true),};let link = link::Link::try_from(DbLink {id: row.id,diff --git a/crates/email_db_client/src/links/get/test.rs b/crates/email_db_client/src/links/get/test.rsindex aa7276de1a..c1920e991e 100644--- a/crates/email_db_client/src/links/get/test.rs+++ b/crates/email_db_client/src/links/get/test.rs@@ -297,7 +297,7 @@ async fn fetch_inbox_details_joins_settings_backfill_and_photo(insert_inbox_with_thread_and_message(&pool, CHILD, "[email protected]").await;insert_settings(&pool, link_id, true, Some("<p>sig</p>")).await;sqlx::query!(- "UPDATE email_settings SET read_receipts_enabled = TRUE WHERE link_id = $1",+ "UPDATE email_settings SET read_receipts_enabled = FALSE WHERE link_id = $1",link_id).execute(&pool)@@ -337,7 +337,7 @@ async fn fetch_inbox_details_joins_settings_backfill_and_photo(assert_eq!(inbox.link.id, link_id);assert!(inbox.settings.signature_on_replies_forwards);assert_eq!(inbox.settings.signature.as_deref(), Some("<p>sig</p>"));- assert!(inbox.settings.read_receipts_enabled);+ assert!(!inbox.settings.read_receipts_enabled);assert_eq!(inbox.latest_backfill_status,Some(BackfillJobStatus::Failed)@@ -630,7 +630,7 @@ async fn fetch_inbox_details_defaults_settings_when_row_missing(assert_eq!(inbox.link.id, link_id);assert!(!inbox.settings.signature_on_replies_forwards);assert!(inbox.settings.signature.is_none());- assert!(!inbox.settings.read_receipts_enabled);+ assert!(inbox.settings.read_receipts_enabled);Ok(())}diff --git a/crates/email_db_client/src/settings.rs b/crates/email_db_client/src/settings.rsindex 382d36e63b..706a9a7095 100644--- a/crates/email_db_client/src/settings.rs+++ b/crates/email_db_client/src/settings.rs@@ -3,8 +3,9 @@ use sqlx::PgPool;use sqlx::types::Uuid;/// Applies a partial update to a user's settings. Fields left `None` in the-/// patch keep their existing value (COALESCE); on a fresh insert, omitted-/// booleans are written as FALSE and `signature` as NULL.+/// patch keep their existing value (COALESCE); on a fresh insert, an omitted+/// `signature_on_replies_forwards` is written as FALSE, an omitted+/// `read_receipts_enabled` as TRUE, and `signature` as NULL.// skip `patch` — it carries the user's signature HTML, which shouldn't hit traces.#[tracing::instrument(skip(pool, patch), err)]pub async fn patch_settings(@@ -15,7 +16,7 @@ pub async fn patch_settings(db::settings::Settings,r#"INSERT INTO email_settings (link_id, signature_on_replies_forwards, signature, read_receipts_enabled)- VALUES ($1, COALESCE($2, FALSE), $3, COALESCE($4, FALSE))+ VALUES ($1, COALESCE($2, FALSE), $3, COALESCE($4, TRUE))ON CONFLICT (link_id)DO UPDATE SETsignature_on_replies_forwards = COALESCE($2, email_settings.signature_on_replies_forwards),diff --git a/crates/email_db_client/src/settings/test.rs b/crates/email_db_client/src/settings/test.rsindex add87786a3..ec428d60b1 100644--- a/crates/email_db_client/src/settings/test.rs+++ b/crates/email_db_client/src/settings/test.rs@@ -27,7 +27,7 @@ fn patch(link_id: Uuid) -> SettingsPatch {}#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]-async fn read_receipts_default_off_and_patch_independently(+async fn read_receipts_default_on_and_patch_independently(pool: Pool<Postgres>,) -> anyhow::Result<()> {let link_id = insert_link(&pool).await;@@ -40,18 +40,18 @@ async fn read_receipts_default_off_and_patch_independently(},).await?;- assert!(!created.read_receipts_enabled);+ assert!(created.read_receipts_enabled);- let enabled = patch_settings(+ let disabled = patch_settings(&pool,SettingsPatch {- read_receipts_enabled: Some(true),+ read_receipts_enabled: Some(false),..patch(link_id)},).await?;- assert!(enabled.read_receipts_enabled);- assert_eq!(enabled.signature.as_deref(), Some("<p>sig</p>"));+ assert!(!disabled.read_receipts_enabled);+ assert_eq!(disabled.signature.as_deref(), Some("<p>sig</p>"));let untouched = patch_settings(&pool,@@ -61,8 +61,8 @@ async fn read_receipts_default_off_and_patch_independently(},).await?;- assert!(untouched.read_receipts_enabled);- assert!(fetch_settings(&pool, link_id).await?.read_receipts_enabled);+ assert!(!untouched.read_receipts_enabled);+ assert!(!fetch_settings(&pool, link_id).await?.read_receipts_enabled);Ok(())}diff --git a/crates/macro_db_client/migrations/20261103172624_email_read_receipts_default_on.sql b/crates/macro_db_client/migrations/20261103172624_email_read_receipts_default_on.sqlnew file mode 100644index 0000000000..1823c29c43--- /dev/null+++ b/crates/macro_db_client/migrations/20261103172624_email_read_receipts_default_on.sql@@ -0,0 +1,4 @@+-- Read receipts are on by default. Every existing row was set to FALSE by the+-- column's original default before anyone could choose, so they flip once.+ALTER TABLE email_settings ALTER COLUMN read_receipts_enabled SET DEFAULT TRUE;+UPDATE email_settings SET read_receipts_enabled = TRUE WHERE NOT read_receipts_enabled;diff --git a/docs/agent-guide/email.md b/docs/agent-guide/email.mdindex 2578c02a6c..4b6b084d90 100644--- a/docs/agent-guide/email.md+++ b/docs/agent-guide/email.md@@ -838,8 +838,8 @@ open shadow root: Playwright text locators can reach them, but a card's ordinary### Read receipts-With `enable-email-read-receipts` on and read receipts turned on for an inbox-(see [Settings](settings.md#email-read-receipts)), messages sent from that+With `enable-email-read-receipts` on and read receipts on for an inbox, which+is the default (see [Settings](settings.md#email-read-receipts)), messages sent from thatinbox show **Opened** or **Not opened** beside the date in the expandedmessage header. The desktop tooltip and the expanded header details (tap theheader caret on touch) give the count and first and last open times. Onlydiff --git a/docs/agent-guide/settings.md b/docs/agent-guide/settings.mdindex c3854cda19..7dc05f42d6 100644--- a/docs/agent-guide/settings.md+++ b/docs/agent-guide/settings.md@@ -118,7 +118,8 @@ under that action, including the account catalog's durable refresh.Behind `enable-email-read-receipts` (on in dev), **Settings → Email → Readreceipts** lists each owned inbox with a switch that saves immediately. It is-off by default. Messages sent from an inbox with it on carry an invisible+on by default, and the section's only copy is "See when recipients open+messages you send." Messages sent from an inbox with it on carry an invisiblepixel; see [read receipts in a thread](email.md#read-receipts) for the status.### Notification permission prompt