Files
webmail-client/backend/migrations/versions/0011_message_delivery_id.py
T
lukasandClaude Opus 4.8 b4e07f11aa collapse cross-account dupes, Lato UI font, mail-list selection & density tuning
Backend:
- Collapse identical cross-account deliveries in a thread: new messages.delivery_id
  (migration 0011) preserves the real Message-ID even when message_id_hdr is
  synthesized (§7.1); get_thread groups by it and reports also_in_account_ids; the
  list count counts distinct deliveries. Backfill script for existing rows.

Frontend:
- Bundle Lato (SIL OFL) as the UI font; unread mail-list rows use Black weight.
- Mail-list selection: hover-avatar checkbox, tri-state "select all", bulk
  Archive/Pin/Delete (Restore/Delete in Archive/Trash/Spam) with a count in the
  reading pane; unread blue dot; "also delivered to" note in the thread.
- Spacing/size tuning: sender-column width, icon gaps, avatar size, bar heights,
  and a round of -1px font sizes across the sidebar, mail list, and reading pane.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U72FZiF1W1pb8XxyWBTREA
2026-07-22 21:49:48 +02:00

39 lines
1.3 KiB
Python

"""add messages.delivery_id
The real header Message-ID as delivered, kept even when message_id_hdr is
synthesized for a cross-account duplicate (SPEC §7.1). It identifies a single
delivery, so the same email delivered to several of the user's accounts can be
collapsed to one row in the thread view. Backfilled from message_id_hdr for
non-synthetic ids; synthetic rows are recovered from the raw blob by a script.
Revision ID: 0011
Revises: 0010
Create Date: 2026-07-22
"""
from __future__ import annotations
from collections.abc import Sequence
from alembic import op
revision: str = "0011"
down_revision: str | None = "0010"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None
def upgrade() -> None:
op.execute("ALTER TABLE messages ADD COLUMN delivery_id text")
# Non-synthetic ids are the real Message-ID already; use them directly.
op.execute(
"UPDATE messages SET delivery_id = message_id_hdr "
"WHERE message_id_hdr IS NOT NULL AND message_id_hdr NOT LIKE '%@synthetic.local'"
)
op.execute("CREATE INDEX ix_messages_delivery ON messages (user_id, delivery_id)")
def downgrade() -> None:
op.execute("DROP INDEX IF EXISTS ix_messages_delivery")
op.execute("ALTER TABLE messages DROP COLUMN IF EXISTS delivery_id")