summaryrefslogtreecommitdiff
path: root/HutchTests/InboxViewModelTests.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-07-15 23:18:20 -0500
committerChristian Cleberg <[email protected]>2026-07-15 23:18:20 -0500
commit97e8b49fcb56751fa0e80a332484db8252753417 (patch)
tree917e5224e64b990617e8ce0f4ee36afc4cc052bd /HutchTests/InboxViewModelTests.swift
parent91023a6572354af7770309715d1d77e978298b0d (diff)
downloadhutch-97e8b49fcb56751fa0e80a332484db8252753417.tar.gz
hutch-97e8b49fcb56751fa0e80a332484db8252753417.tar.bz2
hutch-97e8b49fcb56751fa0e80a332484db8252753417.zip
fix: derive inbox activity from mail, not thread.updated
Thread.updated is the root email's insert time. It never advances when a reply arrives, despite the name and despite the schema describing threads as ordered "most recently bumped". sr.ht returns updated seven seconds after root.date on a thread carrying four replies: subject: "Re: test post" updated: 2026-07-16T03:44:55Z replies: 4 root: { date: 2026-07-15T22:44:48-05:00 } The app fed that field into lastActivityAt everywhere, so a reply to an old thread was invisible: it did not mark the thread unread, did not raise it in the list, and did not update the timestamp beside it. This was inert until the unread baseline landed, because an absent view record returned unread unconditionally and the date was never compared to anything. The baseline did not break unread; it was the first code to depend on that field meaning what it says. Use MailingList.emails instead, which is real reverse-chronological arrival data, keyed by thread root id. The scan stops once it is older than the cutoff, so a quiet list costs one page and a busy one costs only what is new. Threads with nothing in the window keep the root timestamp and stay read, which they already were. Failure returns empty activity rather than throwing: unread is a decoration and should not take the thread list down with it. Uses Email.received rather than Email.date — received is server-side and non-null, date comes from the sender's header and is neither.
Diffstat (limited to 'HutchTests/InboxViewModelTests.swift')
0 files changed, 0 insertions, 0 deletions