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
chore(email-service): Get thread ai tool method (#1788)
Evan Hutnik722d63db29a2
diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lockindex 58b9b5589f..ca2fc015c2 100644--- a/rust/cloud-storage/Cargo.lock+++ b/rust/cloud-storage/Cargo.lock@@ -3571,6 +3571,7 @@ name = "email_utils"version = "0.1.0"dependencies = ["ego-tree",+ "html2text","lazy_static","regex","scraper",@@ -6101,7 +6102,6 @@ dependencies = ["base64 0.22.1","chrono","email_utils",- "html2text","macro_user_id","models_pagination","schemars",diff --git a/rust/cloud-storage/email/src/domain/models/mod.rs b/rust/cloud-storage/email/src/domain/models/mod.rsindex 85dda6f769..a534823041 100644--- a/rust/cloud-storage/email/src/domain/models/mod.rs+++ b/rust/cloud-storage/email/src/domain/models/mod.rs@@ -5,6 +5,7 @@ pub mod error;pub mod label;pub mod link;pub mod message;+pub mod parsed_message;pub mod preview;pub mod thread;@@ -24,6 +25,7 @@ pub use label::{};pub use link::{Link, UserProvider};pub use message::{Message, MessageRow, SimpleMessage};+pub use parsed_message::{ParsedLabel, ParsedMessage, ParsedThread};pub use preview::{EmailThreadPreview, EnrichedEmailThreadPreview, GetEmailsRequest, PreviewCursorQuery,PreviewView, PreviewViewStandardLabel,diff --git a/rust/cloud-storage/email/src/domain/models/parsed_message.rs b/rust/cloud-storage/email/src/domain/models/parsed_message.rsnew file mode 100644index 0000000000..9bba6467be--- /dev/null+++ b/rust/cloud-storage/email/src/domain/models/parsed_message.rs@@ -0,0 +1,49 @@+use chrono::{DateTime, Utc};+use uuid::Uuid;++use super::contact::ContactInfo;++/// A lightweight label representation for parsed messages.+#[derive(Debug, Clone)]+pub struct ParsedLabel {+ /// The provider label ID (e.g., "INBOX", "DRAFT").+ pub provider_id: String,+ /// The human-readable label name.+ pub name: String,+}++/// A lightweight message with parsed body text, without attachments or scheduled send times.+#[derive(Debug, Clone)]+pub struct ParsedMessage {+ /// Database ID of the message.+ pub db_id: Uuid,+ /// Link ID this message belongs to.+ pub link_id: Uuid,+ /// Database ID of the thread this message belongs to.+ pub thread_db_id: Uuid,+ /// Message subject.+ pub subject: Option<String>,+ /// Sender contact info.+ pub from: Option<ContactInfo>,+ /// To recipients.+ pub to: Vec<ContactInfo>,+ /// Cc recipients.+ pub cc: Vec<ContactInfo>,+ /// Bcc recipients.+ pub bcc: Vec<ContactInfo>,+ /// Labels on this message.+ pub labels: Vec<ParsedLabel>,+ /// The body parsed into plaintext (from body_replyless, with HTML converted if needed).+ pub body_parsed: Option<String>,+ /// Internal date timestamp from the provider.+ pub internal_date_ts: Option<DateTime<Utc>>,+}++/// A thread with lightweight parsed messages.+#[derive(Debug, Clone)]+pub struct ParsedThread {+ /// The thread metadata.+ pub row: super::thread::ThreadRow,+ /// Parsed messages in the thread.+ pub messages: Vec<ParsedMessage>,+}diff --git a/rust/cloud-storage/email/src/domain/ports.rs b/rust/cloud-storage/email/src/domain/ports.rsindex 38868bbf50..7b660ad3c8 100644--- a/rust/cloud-storage/email/src/domain/ports.rs+++ b/rust/cloud-storage/email/src/domain/ports.rs@@ -2,8 +2,8 @@ use crate::domain::models::{Attachment, AttachmentDraft, AttachmentForwarded, Contact, ContactInfo, CreateDraftInput,CreatedDraft, EmailErr, EmailThreadPreview, EnrichedEmailThreadPreview, GetEmailsRequest,Label, Link, LinkLabel, MessageAttachment, MessageLabel, MessageRow, ParsedAddresses,- PreviewCursorQuery, RecipientType, ResolvedDraftInput, SimpleMessage, SimpleMessageInfo,- Thread, ThreadRow, UpdateThreadLabelsResult, UpsertedContacts, UserProvider,+ ParsedThread, PreviewCursorQuery, RecipientType, ResolvedDraftInput, SimpleMessage,+ SimpleMessageInfo, Thread, ThreadRow, UpdateThreadLabelsResult, UpsertedContacts, UserProvider,};use chrono::{DateTime, Utc};use entity_access::domain::models::{EntityAccessReceipt, ViewAccessLevel};@@ -228,6 +228,14 @@ pub trait EmailService: Send + Sync + 'static {limit: i64,) -> impl Future<Output = Result<Option<Thread>, EmailErr>> + Send;+ /// Fetch a thread with lightweight parsed messages (no attachments or scheduled send times).+ fn get_thread_parsed(+ &self,+ receipt: EntityAccessReceipt<ViewAccessLevel>,+ offset: i64,+ limit: i64,+ ) -> impl Future<Output = Result<Option<ParsedThread>, EmailErr>> + Send;+/// Create a draft message for the given link.fn create_draft(&self,diff --git a/rust/cloud-storage/email/src/domain/service/mod.rs b/rust/cloud-storage/email/src/domain/service/mod.rsindex ab49db3824..bf206edde2 100644--- a/rust/cloud-storage/email/src/domain/service/mod.rs+++ b/rust/cloud-storage/email/src/domain/service/mod.rs@@ -7,7 +7,7 @@ mod thread_labels;use crate::domain::{models::{CreateDraftInput, CreatedDraft, EmailErr, EnrichedEmailThreadPreview, GetEmailsRequest,- Link, LinkLabel, Thread, UpdateThreadLabelsResult,+ Link, LinkLabel, ParsedThread, Thread, UpdateThreadLabelsResult,},ports::{EmailMessageEnqueuer, EmailRepo, EmailService, GmailLabelModifier},};@@ -85,6 +85,15 @@ where.await}+ async fn get_thread_parsed(+ &self,+ receipt: EntityAccessReceipt<ViewAccessLevel>,+ offset: i64,+ limit: i64,+ ) -> Result<Option<ParsedThread>, EmailErr> {+ self.get_thread_parsed_impl(receipt, offset, limit).await+ }+async fn create_draft(&self,link: &Link,diff --git a/rust/cloud-storage/email/src/domain/service/thread.rs b/rust/cloud-storage/email/src/domain/service/thread.rsindex 008a877d89..2478068cec 100644--- a/rust/cloud-storage/email/src/domain/service/thread.rs+++ b/rust/cloud-storage/email/src/domain/service/thread.rs@@ -1,16 +1,32 @@use crate::domain::{assembler::{message_from_row, split_recipients, thread_from_row},- models::{EmailErr, Message, Thread},- ports::EmailRepo,+ models::{+ ContactInfo, EmailErr, Message, MessageLabel, MessageRow, ParsedLabel, ParsedMessage,+ ParsedThread, Thread, ThreadRow,+ },+ ports::{EmailRepo, RecipientsByMessageId},};use entity_access::domain::models::{AccessLevel, EntityAccessReceipt, EntityPermission, ViewAccessLevel,};use frecency::domain::ports::FrecencyQueryService;+use std::collections::HashMap;use uuid::Uuid;use super::EmailServiceImpl;+/// The shared ingredients fetched for any thread query: thread row, message rows,+/// senders, recipients, labels, and whether the caller is the owner.+struct ThreadFetchResult {+ thread_row: ThreadRow,+ message_rows: Vec<MessageRow>,+ message_ids: Vec<Uuid>,+ senders: HashMap<Uuid, ContactInfo>,+ recipients: RecipientsByMessageId,+ labels: HashMap<Uuid, Vec<MessageLabel>>,+ is_owner: bool,+}+impl<T, U, E, G> EmailServiceImpl<T, U, E, G>whereT: EmailRepo,@@ -18,13 +34,14 @@ whereE: crate::domain::ports::EmailMessageEnqueuer,anyhow::Error: From<T::Err>,{- #[tracing::instrument(err, skip(self, receipt))]- pub(crate) async fn get_thread_with_messages_impl(+ /// Fetch thread row, paginated messages, and their core sub-resources+ /// (senders, recipients, labels). Returns `None` if the thread doesn't exist.+ async fn fetch_thread_core(&self,- receipt: EntityAccessReceipt<ViewAccessLevel>,+ receipt: &EntityAccessReceipt<ViewAccessLevel>,offset: i64,limit: i64,- ) -> Result<Option<Thread>, EmailErr> {+ ) -> Result<Option<ThreadFetchResult>, EmailErr> {let thread_id = Uuid::parse_str(&receipt.entity().entity_id).map_err(|e| EmailErr::RepoErr(anyhow::anyhow!("invalid thread id: {}", e)))?;@@ -44,31 +61,28 @@ where.await.map_err(anyhow::Error::from)?;- if message_rows.is_empty() {- return Ok(Some(thread_from_row(thread_row, vec![])));- }+ let is_owner = matches!(+ receipt.entity_permission(),+ EntityPermission::AccessLevel {+ access_level: AccessLevel::Owner+ }+ );let message_ids: Vec<Uuid> = message_rows.iter().map(|m| m.db_id).collect();- let message_ids_with_attachments: Vec<Uuid> = message_rows- .iter()- .filter(|m| m.has_attachments)- .map(|m| m.db_id)- .collect();- let draft_message_ids: Vec<Uuid> = message_rows- .iter()- .filter(|m| m.provider_id.is_none())- .map(|m| m.db_id)- .collect();- let (- senders_result,- recipients_result,- scheduled_result,- labels_result,- attachments_result,- draft_attachments_result,- forwarded_attachments_result,- ) = tokio::try_join!(+ if message_ids.is_empty() {+ return Ok(Some(ThreadFetchResult {+ thread_row,+ message_rows: vec![],+ message_ids: vec![],+ senders: HashMap::new(),+ recipients: HashMap::new(),+ labels: HashMap::new(),+ is_owner,+ }));+ }++ let (senders, recipients, labels) = tokio::try_join!(async {self.email_repo.senders_by_message_ids(&message_ids)@@ -83,13 +97,58 @@ where},async {self.email_repo- .scheduled_send_times_by_message_ids(&message_ids)+ .labels_by_message_ids(&message_ids).await.map_err(anyhow::Error::from)},+ )?;++ Ok(Some(ThreadFetchResult {+ thread_row,+ message_rows,+ message_ids,+ senders,+ recipients,+ labels,+ is_owner,+ }))+ }++ #[tracing::instrument(err, skip(self, receipt))]+ pub(crate) async fn get_thread_with_messages_impl(+ &self,+ receipt: EntityAccessReceipt<ViewAccessLevel>,+ offset: i64,+ limit: i64,+ ) -> Result<Option<Thread>, EmailErr> {+ let Some(ThreadFetchResult {+ thread_row,+ message_rows,+ message_ids,+ mut senders,+ mut recipients,+ mut labels,+ is_owner,+ }) = self.fetch_thread_core(&receipt, offset, limit).await?+ else {+ return Ok(None);+ };++ let message_ids_with_attachments: Vec<Uuid> = message_rows+ .iter()+ .filter(|m| m.has_attachments)+ .map(|m| m.db_id)+ .collect();+ let draft_message_ids: Vec<Uuid> = message_rows+ .iter()+ .filter(|m| m.provider_id.is_none())+ .map(|m| m.db_id)+ .collect();++ let (mut scheduled, mut attachments, mut draft_attachments, mut forwarded_attachments) = tokio::try_join!(async {self.email_repo- .labels_by_message_ids(&message_ids)+ .scheduled_send_times_by_message_ids(&message_ids).await.map_err(anyhow::Error::from)},@@ -113,24 +172,8 @@ where},)?;- let mut senders = senders_result;- let mut recipients = recipients_result;- let mut scheduled = scheduled_result;- let mut labels = labels_result;- let mut attachments = attachments_result;- let mut draft_attachments = draft_attachments_result;- let mut forwarded_attachments = forwarded_attachments_result;-- let is_owner = matches!(- receipt.entity_permission(),- EntityPermission::AccessLevel {- access_level: AccessLevel::Owner- }- );-let messages: Vec<Message> = message_rows.into_iter()- // don't include drafts for non-owners.filter(|row| is_owner || !row.is_draft).map(|row| {let sender = senders.remove(&row.db_id);@@ -169,4 +212,73 @@ whereOk(Some(thread_from_row(thread_row, messages)))}++ #[tracing::instrument(err, skip(self, receipt))]+ pub(crate) async fn get_thread_parsed_impl(+ &self,+ receipt: EntityAccessReceipt<ViewAccessLevel>,+ offset: i64,+ limit: i64,+ ) -> Result<Option<ParsedThread>, EmailErr> {+ let Some(ThreadFetchResult {+ thread_row,+ message_rows,+ message_ids: _,+ mut senders,+ mut recipients,+ mut labels,+ is_owner,+ }) = self.fetch_thread_core(&receipt, offset, limit).await?+ else {+ return Ok(None);+ };++ let messages: Vec<ParsedMessage> = message_rows+ .into_iter()+ .filter(|row| is_owner || !row.is_draft)+ .map(|row| {+ let sender = senders.remove(&row.db_id);+ let recipient_list = recipients.remove(&row.db_id).unwrap_or_default();+ let message_labels = labels.remove(&row.db_id).unwrap_or_default();++ let (to, cc, bcc) = split_recipients(recipient_list);++ let body_replyless = email_utils::body_replyless::compute_body_replyless(+ row.subject.as_deref(),+ row.body_html_sanitized.as_deref(),+ row.body_text.as_deref(),+ );++ let body_parsed = email_utils::body_parsed::compute_body_parsed(+ row.body_html_sanitized.is_some(),+ &body_replyless,+ );++ ParsedMessage {+ db_id: row.db_id,+ link_id: row.link_id,+ thread_db_id: row.thread_db_id,+ subject: row.subject,+ from: sender,+ to,+ cc,+ bcc,+ labels: message_labels+ .into_iter()+ .map(|l| ParsedLabel {+ provider_id: l.provider_label_id,+ name: l.name.unwrap_or_default(),+ })+ .collect(),+ body_parsed,+ internal_date_ts: row.internal_date_ts,+ }+ })+ .collect();++ Ok(Some(ParsedThread {+ row: thread_row,+ messages,+ }))+ }}diff --git a/rust/cloud-storage/email_utils/Cargo.toml b/rust/cloud-storage/email_utils/Cargo.tomlindex 2833e8195a..060bd66ec0 100644--- a/rust/cloud-storage/email_utils/Cargo.toml+++ b/rust/cloud-storage/email_utils/Cargo.toml@@ -6,6 +6,7 @@ edition = "2024"[dependencies]ego-tree = { workspace = true }+html2text = "0.15.1"lazy_static = { workspace = true }regex = { workspace = true }scraper = { workspace = true }\ No newline at end of filediff --git a/rust/cloud-storage/email_utils/src/body_parsed.rs b/rust/cloud-storage/email_utils/src/body_parsed.rsnew file mode 100644index 0000000000..f7f144e95e--- /dev/null+++ b/rust/cloud-storage/email_utils/src/body_parsed.rs@@ -0,0 +1,144 @@+use html2text::config::Config;+use html2text::render::PlainDecorator;++/// Convert `body_replyless` into plaintext with link footnotes.+///+/// If the original message had no HTML body, `body_replyless` is already plaintext.+/// Otherwise it's HTML and is parsed to plaintext using `html2text`.+pub fn compute_body_parsed(has_html: bool, body_replyless: &Option<String>) -> Option<String> {+ let text = body_replyless.as_ref()?;++ if !has_html {+ return Some(text.clone());+ }++ let config = html2text::config::plain()+ .no_table_borders()+ .link_footnotes(true);++ parse_html_to_text(text, config)+}++/// Convert `body_replyless` into plaintext without link footnotes or brackets.+///+/// Same as [`compute_body_parsed`] but strips link wrapping and square brackets,+/// producing cleaner text for search indexing.+pub fn compute_body_parsed_linkless(+ has_html: bool,+ body_replyless: &Option<String>,+) -> Option<String> {+ let text = body_replyless.as_ref()?;++ if !has_html {+ return Some(text.clone());+ }++ let config = html2text::config::plain()+ .no_table_borders()+ .link_footnotes(false)+ .no_link_wrapping();++ parse_html_to_text(text, config).map(|mut text| {+ text.retain(|c| c != '[' && c != ']');+ text+ })+}++fn parse_html_to_text(html: &str, config: Config<PlainDecorator>) -> Option<String> {+ match config.string_from_read(html.as_bytes(), usize::MAX) {+ Ok(text) => {+ let trimmed = text+ .lines()+ .map(|line| line.trim())+ .filter(|line| !line.is_empty())+ .collect::<Vec<&str>>()+ .join("\n");+ Some(trimmed)+ }+ Err(_) => None,+ }+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn test_plaintext_passthrough() {+ let body = Some("Hello, world!".to_string());+ let result = compute_body_parsed(false, &body);+ assert_eq!(result, Some("Hello, world!".to_string()));+ }++ #[test]+ fn test_none_body() {+ assert_eq!(compute_body_parsed(false, &None), None);+ assert_eq!(compute_body_parsed(true, &None), None);+ }++ #[test]+ fn test_html_to_text() {+ let body = Some("<html><body><p>Hello, world!</p></body></html>".to_string());+ let result = compute_body_parsed(true, &body);+ assert_eq!(result, Some("Hello, world!".to_string()));+ }++ #[test]+ fn test_empty_html() {+ let body = Some("".to_string());+ let result = compute_body_parsed(true, &body);+ assert_eq!(result, Some("".to_string()));+ }++ #[test]+ fn test_malformed_html() {+ let body = Some("<p>Unclosed paragraph<div>Nested content</p>".to_string());+ let result = compute_body_parsed(true, &body);+ assert!(result.is_some());+ let text = result.unwrap();+ assert!(text.contains("Unclosed paragraph"));+ assert!(text.contains("Nested content"));+ }++ #[test]+ fn test_formatted_email() {+ let body = Some(+ r#"+ <html>+ <body>+ <div>+ <p>Hi John,</p>+ <p>Thank you for your inquiry about our services.</p>+ <p>Our team will get back to you within 24 hours.</p>+ <hr>+ <div style="color: gray; font-size: 12px;">+ <p>Example Corp.</p>+ <p>123 Business St.<br>Suite 100<br>San Francisco, CA 94107</p>+ <p>Phone: (555) 555-5555</p>+ </div>+ </div>+ </body>+ </html>+ "#+ .to_string(),+ );++ let result = compute_body_parsed(true, &body);+ assert!(result.is_some());+ let text = result.unwrap();+ assert!(text.contains("Hi John,"));+ assert!(text.contains("Thank you for your inquiry"));+ assert!(text.contains("Example Corp."));+ assert!(text.contains("123 Business St."));+ }++ #[test]+ fn test_linkless_strips_brackets() {+ let body = Some("<p>Visit <a href=\"https://example.com\">example</a></p>".to_string());+ let result = compute_body_parsed_linkless(true, &body);+ assert!(result.is_some());+ let text = result.unwrap();+ assert!(!text.contains('['));+ assert!(!text.contains(']'));+ }+}diff --git a/rust/cloud-storage/email_utils/src/lib.rs b/rust/cloud-storage/email_utils/src/lib.rsindex 30d5b3f9ba..a14d2f2df9 100644--- a/rust/cloud-storage/email_utils/src/lib.rs+++ b/rust/cloud-storage/email_utils/src/lib.rs@@ -1,3 +1,4 @@+pub mod body_parsed;pub mod body_replyless;pub mod generic_email;pub mod normalize_contact;diff --git a/rust/cloud-storage/models_email/Cargo.toml b/rust/cloud-storage/models_email/Cargo.tomlindex e9d0bf5d35..1e141f0fe2 100644--- a/rust/cloud-storage/models_email/Cargo.toml+++ b/rust/cloud-storage/models_email/Cargo.toml@@ -9,7 +9,6 @@ anyhow = { workspace = true }base64 = { workspace = true }chrono = { workspace = true }email_utils = { path = "../email_utils" }-html2text = "0.15.1"macro_user_id = { path = "../macro_user_id" }models_pagination = { path = "../models_pagination" }schemars = { workspace = true }diff --git a/rust/cloud-storage/models_email/src/email/service/body_parsing/body_parsed.rs b/rust/cloud-storage/models_email/src/email/service/body_parsing/body_parsed.rsindex f4e785aec3..8951a46301 100644--- a/rust/cloud-storage/models_email/src/email/service/body_parsing/body_parsed.rs+++ b/rust/cloud-storage/models_email/src/email/service/body_parsing/body_parsed.rs@@ -1,150 +1,17 @@use crate::email::service::message;-use html2text::config::Config;-use html2text::render::PlainDecorator;pub fn get_body_parsed_for_message(message: &message::MessageWithBodyReplyless) -> Option<String> {- // if the message has no body_html, that means the body_replyless- // is plaintext. meaning it's already parsed, and we can just use that.- if message.inner.body_html_sanitized.is_none() {- message.body_replyless.clone()- } else {- // Otherwise, body_replyless is html, and we need to parse it into plaintext.-- let config = html2text::config::plain()- .no_table_borders()- .link_footnotes(true);-- parse_html_to_text(&message.body_replyless, config)- }+ email_utils::body_parsed::compute_body_parsed(+ message.inner.body_html_sanitized.is_some(),+ &message.body_replyless,+ )}pub fn get_body_parsed_linkless_for_message(message: &message::MessageWithBodyReplyless,) -> Option<String> {- // if the message has no body_html, that means the body_replyless- // is plaintext. meaning it's already parsed, and we can just use that.- if message.inner.body_html_sanitized.is_none() {- message.body_replyless.clone()- } else {- // Otherwise, body_replyless is html, and we need to parse it into plaintext.-- let config = html2text::config::plain()- .no_table_borders()- .link_footnotes(false)- .no_link_wrapping();-- // remove square brackets around links- parse_html_to_text(&message.body_replyless, config)- // more performant than .replace() as .replace() makes a copy- .map(|mut text| {- text.retain(|c| c != '[' && c != ']');- text- })- }-}--fn parse_html_to_text(- body_html_sanitized: &Option<String>,- config: Config<PlainDecorator>,-) -> Option<String> {- if let Some(html) = body_html_sanitized {- match config.string_from_read(html.as_bytes(), usize::MAX) {- Ok(text) => {- let trimmed_text = text- .lines()- .map(|line| line.trim())- .filter(|line| !line.is_empty())- .collect::<Vec<&str>>()- .join("\n");-- Some(trimmed_text)- }- Err(_) => None,- }- } else {- None- }-}--#[cfg(test)]-mod tests {- use super::*;-- fn get_default_config() -> Config<PlainDecorator> {- html2text::config::plain()- .no_table_borders()- .link_footnotes(true)- }-- #[test]- fn test_parse_html_to_text_with_simple_html() {- let html = Some("<html><body><p>Hello, world!</p></body></html>".to_string());-- let result = parse_html_to_text(&html, get_default_config());-- assert_eq!(result, Some("Hello, world!".to_string()));- }-- #[test]- fn test_parse_html_to_text_with_none() {- let html: Option<String> = None;-- let result = parse_html_to_text(&html, get_default_config());- assert_eq!(result, None);- }-- #[test]- fn test_parse_html_to_text_with_empty_html() {- let html = Some("".to_string());-- let result = parse_html_to_text(&html, get_default_config());-- assert_eq!(result, Some("".to_string()));- }-- #[test]- fn test_parse_html_to_text_with_malformed_html() {- let html = Some("<p>Unclosed paragraph<div>Nested content</p>".to_string());-- let result = parse_html_to_text(&html, get_default_config());-- // html2text is pretty forgiving with malformed HTML- assert!(result.is_some());- let text = result.unwrap();- assert!(text.contains("Unclosed paragraph"));- assert!(text.contains("Nested content"));- }-- #[test]- fn test_parse_html_to_text_with_formatted_email() {- let html = Some(- r#"- <html>- <body>- <div>- <p>Hi John,</p>- <p>Thank you for your inquiry about our services.</p>- <p>Our team will get back to you within 24 hours.</p>- <hr>- <div style="color: gray; font-size: 12px;">- <p>Example Corp.</p>- <p>123 Business St.<br>Suite 100<br>San Francisco, CA 94107</p>- <p>Phone: (555) 555-5555</p>- </div>- </div>- </body>- </html>- "#- .to_string(),- );-- let result = parse_html_to_text(&html, get_default_config());-- assert!(result.is_some());- let text = result.unwrap();- assert!(text.contains("Hi John,"));- assert!(text.contains("Thank you for your inquiry"));- assert!(text.contains("Example Corp."));- assert!(text.contains("123 Business St."));- }+ email_utils::body_parsed::compute_body_parsed_linkless(+ message.inner.body_html_sanitized.is_some(),+ &message.body_replyless,+ )}diff --git a/rust/cloud-storage/soup/src/domain/service/tests.rs b/rust/cloud-storage/soup/src/domain/service/tests.rsindex a587db0fb3..5edf42d1ee 100644--- a/rust/cloud-storage/soup/src/domain/service/tests.rs+++ b/rust/cloud-storage/soup/src/domain/service/tests.rs@@ -56,6 +56,15 @@ impl EmailService for NoopEmailService {Err(EmailErr::RepoErr(anyhow::anyhow!("not implemented")))}+ async fn get_thread_parsed(+ &self,+ _receipt: EntityAccessReceipt<ViewAccessLevel>,+ _offset: i64,+ _limit: i64,+ ) -> Result<Option<email::domain::models::ParsedThread>, EmailErr> {+ Err(EmailErr::RepoErr(anyhow::anyhow!("not implemented")))+ }+async fn create_draft(&self,_link: &email::domain::models::Link,diff --git a/rust/cloud-storage/soup/src/inbound/axum_router/tests.rs b/rust/cloud-storage/soup/src/inbound/axum_router/tests.rsindex 951ac2afbc..a7c5ec12d7 100644--- a/rust/cloud-storage/soup/src/inbound/axum_router/tests.rs+++ b/rust/cloud-storage/soup/src/inbound/axum_router/tests.rs@@ -100,6 +100,15 @@ impl EmailService for MockEmail {Err(EmailErr::RepoErr(anyhow::anyhow!("Not implemented")))}+ async fn get_thread_parsed(+ &self,+ _receipt: EntityAccessReceipt<ViewAccessLevel>,+ _offset: i64,+ _limit: i64,+ ) -> Result<Option<email::domain::models::ParsedThread>, EmailErr> {+ Err(EmailErr::RepoErr(anyhow::anyhow!("Not implemented")))+ }+async fn create_draft(&self,_link: &email::domain::models::Link,@@ -206,6 +215,15 @@ impl EmailService for MockEmailLinkResult {Err(EmailErr::RepoErr(anyhow::anyhow!("Not implemented")))}+ async fn get_thread_parsed(+ &self,+ _receipt: EntityAccessReceipt<ViewAccessLevel>,+ _offset: i64,+ _limit: i64,+ ) -> Result<Option<email::domain::models::ParsedThread>, EmailErr> {+ Err(EmailErr::RepoErr(anyhow::anyhow!("Not implemented")))+ }+async fn create_draft(&self,_link: &email::domain::models::Link,