thread fix
This commit is contained in:
parent
d58fb8841b
commit
a58ba11566
11 changed files with 177 additions and 30 deletions
|
|
@ -13,6 +13,7 @@ from app.services.external_reply_service import log_original_external_message
|
|||
from app.services.human_handoff_service import MESSAGE_SCOPE_EXTERNAL
|
||||
from app.services.message_ids import canonical_message_id, message_id_fields
|
||||
from app.services.mime_parser import parse_mime
|
||||
from app.services.reply_extractor import build_reply_display
|
||||
from app.services.raw_mime_storage import delivery_digest, get_raw_mime_storage
|
||||
from app.services.thread_resolver import participants_from_parsed, resolve_thread
|
||||
from app.services.thread_service import ensure_thread_for_message, message_event_at
|
||||
|
|
@ -155,12 +156,26 @@ class InboundHandler:
|
|||
raise RuntimeError("Inbound message was not persisted.")
|
||||
|
||||
if body_text or body_html:
|
||||
reply_display = build_reply_display(body_text=body_text, body_html=body_html)
|
||||
await mongo_db.messages.update_one(
|
||||
{"_id": persisted["_id"]},
|
||||
{"$set": {"body_text": body_text, "body_html": body_html}},
|
||||
{
|
||||
"$set": {
|
||||
"body_text": body_text,
|
||||
"body_html": body_html,
|
||||
"new_reply_content": reply_display["new_reply_content"],
|
||||
"quoted_content": reply_display["quoted_content"],
|
||||
"has_quoted_text": reply_display["has_quoted_text"],
|
||||
"snippet": reply_display["snippet"],
|
||||
}
|
||||
},
|
||||
)
|
||||
persisted["body_text"] = body_text
|
||||
persisted["body_html"] = body_html
|
||||
persisted["snippet"] = reply_display["snippet"]
|
||||
persisted["new_reply_content"] = reply_display["new_reply_content"]
|
||||
persisted["quoted_content"] = reply_display["quoted_content"]
|
||||
persisted["has_quoted_text"] = reply_display["has_quoted_text"]
|
||||
|
||||
participants = participants_from_parsed(parsed)
|
||||
for recipient in recipients:
|
||||
|
|
@ -214,7 +229,7 @@ class InboundHandler:
|
|||
"sender": parsed["sender"],
|
||||
"recipients": parsed["to"],
|
||||
"subject": parsed["subject"],
|
||||
"snippet": parsed["snippet"],
|
||||
"snippet": persisted.get("snippet", parsed["snippet"]),
|
||||
"attachments": parsed["attachments"],
|
||||
"status": "received",
|
||||
"is_read": False,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue