mail UX: restore-to-folder, draft/attachment fixes, printing, sidebar collapse
Backend: - Restore returns each message to its original folder (e.g. Sent/Archive) instead of always the Inbox: new messages.restore_mailbox_id (migration 0010) + restore_thread_job. - Drafts: expunge reconciliation for the Drafts poll (provider.list_uids / _reconcile_drafts) clears phantom "remote" drafts; send + discard drop the mirrored DB row; adopting a remote draft carries its real attachments into the compose flow. - Thread detail/list are folder-aware: individually trashed/spam messages are hidden outside their folder, Trash/Spam show only their own messages, and the mail-list message count matches the view. Frontend: - Thread reading panel: fix newest-first card overlap/spacing (expand-all and single expand), hide Reply/Forward on trashed messages, close the Actions menu on message-body (iframe) clicks, scroll to the inline composer, and prompt Save draft / Discard on the X close. - Composer: remount when switching drafts, dirty-tracking to stop duplicate IMAP mirrors, and close the From/More dropdowns on outside click. - Sidebar: collapse/expand toggle (icons-only ~60px rail) and a log-out icon on Sign out. - Mail-standard printing in a new window with reliable page margins (lib/print.ts). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U72FZiF1W1pb8XxyWBTREA
This commit is contained in:
@@ -254,6 +254,50 @@ async def test_thread_detail_messages_ascending(api: ApiCtx) -> None:
|
||||
assert dates == sorted(dates) # ascending
|
||||
|
||||
|
||||
async def test_thread_detail_hides_trashed_message_unless_viewing_trash(api: ApiCtx) -> None:
|
||||
assert api.session is not None
|
||||
# Give the account a Trash folder and delete a single message of the 2-message
|
||||
# kickoff thread (move it to Trash) — as the per-message Delete action does.
|
||||
trash = Mailbox(
|
||||
account_id=api.account_id, user_id=api.user_id, path="Trash", special_use="trash"
|
||||
)
|
||||
api.session.add(trash)
|
||||
await api.session.flush()
|
||||
resp = await api.client.get("/api/threads")
|
||||
kickoff = next(t for t in resp.json()["threads"] if t["message_count"] == 2)
|
||||
detail = (await api.client.get(f"/api/threads/{kickoff['id']}")).json()
|
||||
victim = uuid.UUID(detail["messages"][-1]["id"])
|
||||
msg = await api.session.get(Message, victim)
|
||||
assert msg is not None
|
||||
msg.mailbox_id = trash.id
|
||||
await api.session.commit()
|
||||
|
||||
# Viewing the thread from the Inbox: the trashed message is gone.
|
||||
inbox_view = await api.client.get(
|
||||
f"/api/threads/{kickoff['id']}", params={"view": "folder:inbox"}
|
||||
)
|
||||
ids = [m["id"] for m in inbox_view.json()["messages"]]
|
||||
assert str(victim) not in ids
|
||||
assert len(ids) == 1
|
||||
|
||||
# Viewing from the Trash folder: only the trashed message is shown (Trash is
|
||||
# message-scoped), not the rest of the conversation.
|
||||
trash_view = await api.client.get(
|
||||
f"/api/threads/{kickoff['id']}", params={"view": "folder:trash"}
|
||||
)
|
||||
ids_trash = [m["id"] for m in trash_view.json()["messages"]]
|
||||
assert ids_trash == [str(victim)]
|
||||
|
||||
# The Inbox LIST count drops the trashed message (was 2, now 1); the Trash list
|
||||
# counts only the one trashed message.
|
||||
inbox_list = await api.client.get("/api/threads", params={"view": "folder:inbox"})
|
||||
row = next(t for t in inbox_list.json()["threads"] if t["id"] == kickoff["id"])
|
||||
assert row["message_count"] == 1
|
||||
trash_list = await api.client.get("/api/threads", params={"view": "folder:trash"})
|
||||
trow = next(t for t in trash_list.json()["threads"] if t["id"] == kickoff["id"])
|
||||
assert trow["message_count"] == 1
|
||||
|
||||
|
||||
async def test_message_html_is_sanitized(api: ApiCtx) -> None:
|
||||
# the lunch message has HTML with a script
|
||||
resp = await api.client.get("/api/threads")
|
||||
|
||||
Reference in New Issue
Block a user