summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Hutch/App/RootView.swift6
-rw-r--r--Hutch/Models/Inbox.swift5
-rw-r--r--Hutch/Views/Home/HomeViewModel.swift6
-rw-r--r--Hutch/Views/Lookup/LookupView.swift6
-rw-r--r--Hutch/Views/Projects/ProjectMailingListView.swift6
5 files changed, 16 insertions, 13 deletions
diff --git a/Hutch/App/RootView.swift b/Hutch/App/RootView.swift
index e223766..1ae4651 100644
--- a/Hutch/App/RootView.swift
+++ b/Hutch/App/RootView.swift
@@ -476,15 +476,15 @@ private struct MoreNavigationRoot: View {
ThreadDetailView(
thread: thread,
onViewed: {
- InboxReadStateStore.markViewed(max(Date(), thread.lastActivityAt), for: thread.id, defaults: appState.accountDefaults)
+ InboxReadStateStore.markViewed(max(Date(), thread.lastActivityAt), for: thread.threadGroupingKey, defaults: appState.accountDefaults)
NeedsAttentionSnapshotStore.adjustUnreadInboxThreads(by: -1, accountID: appState.activeAccountID)
},
onMarkRead: {
- InboxReadStateStore.markViewed(max(Date(), thread.lastActivityAt), for: thread.id, defaults: appState.accountDefaults)
+ InboxReadStateStore.markViewed(max(Date(), thread.lastActivityAt), for: thread.threadGroupingKey, defaults: appState.accountDefaults)
NeedsAttentionSnapshotStore.adjustUnreadInboxThreads(by: -1, accountID: appState.activeAccountID)
},
onMarkUnread: {
- InboxReadStateStore.markUnread(for: thread.id, defaults: appState.accountDefaults)
+ InboxReadStateStore.markUnread(for: thread.threadGroupingKey, defaults: appState.accountDefaults)
NeedsAttentionSnapshotStore.adjustUnreadInboxThreads(by: 1, accountID: appState.activeAccountID)
}
)
diff --git a/Hutch/Models/Inbox.swift b/Hutch/Models/Inbox.swift
index 071bcbc..be2e105 100644
--- a/Hutch/Models/Inbox.swift
+++ b/Hutch/Models/Inbox.swift
@@ -17,8 +17,11 @@ struct InboxThreadSummary: Identifiable, Hashable, Sendable {
let containsPatch: Bool
let isUnread: Bool
+ /// Identity is per-thread, keyed on the root Message-ID. It deliberately differs
+ /// from ``threadGroupingKey``, which is subject-based so replies collapse into
+ /// one conversation — two unrelated threads can share a subject on the same list.
var id: String {
- threadGroupingKey
+ "\(listRID)#\(rootMessageID)"
}
var listDisplayName: String {
diff --git a/Hutch/Views/Home/HomeViewModel.swift b/Hutch/Views/Home/HomeViewModel.swift
index 2cd4869..4436f0c 100644
--- a/Hutch/Views/Home/HomeViewModel.swift
+++ b/Hutch/Views/Home/HomeViewModel.swift
@@ -622,7 +622,7 @@ final class HomeViewModel {
}
func markInboxThreadRead(_ thread: InboxThreadSummary) {
- InboxReadStateStore.markViewed(max(Date(), thread.lastActivityAt), for: thread.id, defaults: defaults)
+ InboxReadStateStore.markViewed(max(Date(), thread.lastActivityAt), for: thread.threadGroupingKey, defaults: defaults)
unreadInboxThreads.removeAll { $0.id == thread.id }
unreadInboxThreadCount = max((unreadInboxThreadCount ?? 1) - 1, 0)
hasUnreadInboxThreads = (unreadInboxThreadCount ?? 0) > 0
@@ -634,7 +634,7 @@ final class HomeViewModel {
let viewedAt = Date()
for thread in unreadInboxThreads {
- InboxReadStateStore.markViewed(max(viewedAt, thread.lastActivityAt), for: thread.id, defaults: defaults)
+ InboxReadStateStore.markViewed(max(viewedAt, thread.lastActivityAt), for: thread.threadGroupingKey, defaults: defaults)
}
unreadInboxThreads = []
@@ -644,7 +644,7 @@ final class HomeViewModel {
}
func markInboxThreadUnread(_ thread: InboxThreadSummary) {
- InboxReadStateStore.markUnread(for: thread.id, defaults: defaults)
+ InboxReadStateStore.markUnread(for: thread.threadGroupingKey, defaults: defaults)
if unreadInboxThreads.contains(where: { $0.id == thread.id }) == false {
unreadInboxThreads.append(
InboxThreadSummary(
diff --git a/Hutch/Views/Lookup/LookupView.swift b/Hutch/Views/Lookup/LookupView.swift
index 6f7ebe1..2a26282 100644
--- a/Hutch/Views/Lookup/LookupView.swift
+++ b/Hutch/Views/Lookup/LookupView.swift
@@ -469,15 +469,15 @@ struct LookupView: View {
ThreadDetailView(
thread: thread,
onViewed: {
- InboxReadStateStore.markViewed(max(Date(), thread.lastActivityAt), for: thread.id, defaults: appState.accountDefaults)
+ InboxReadStateStore.markViewed(max(Date(), thread.lastActivityAt), for: thread.threadGroupingKey, defaults: appState.accountDefaults)
NeedsAttentionSnapshotStore.adjustUnreadInboxThreads(by: -1, accountID: appState.activeAccountID)
},
onMarkRead: {
- InboxReadStateStore.markViewed(max(Date(), thread.lastActivityAt), for: thread.id, defaults: appState.accountDefaults)
+ InboxReadStateStore.markViewed(max(Date(), thread.lastActivityAt), for: thread.threadGroupingKey, defaults: appState.accountDefaults)
NeedsAttentionSnapshotStore.adjustUnreadInboxThreads(by: -1, accountID: appState.activeAccountID)
},
onMarkUnread: {
- InboxReadStateStore.markUnread(for: thread.id, defaults: appState.accountDefaults)
+ InboxReadStateStore.markUnread(for: thread.threadGroupingKey, defaults: appState.accountDefaults)
NeedsAttentionSnapshotStore.adjustUnreadInboxThreads(by: 1, accountID: appState.activeAccountID)
}
)
diff --git a/Hutch/Views/Projects/ProjectMailingListView.swift b/Hutch/Views/Projects/ProjectMailingListView.swift
index ca6066c..d466121 100644
--- a/Hutch/Views/Projects/ProjectMailingListView.swift
+++ b/Hutch/Views/Projects/ProjectMailingListView.swift
@@ -94,13 +94,13 @@ final class MailingListDetailViewModel {
func markThreadRead(_ thread: InboxThreadSummary) {
let viewedAt = max(Date(), thread.lastActivityAt)
- InboxReadStateStore.markViewed(viewedAt, for: thread.id, defaults: defaults)
+ InboxReadStateStore.markViewed(viewedAt, for: thread.threadGroupingKey, defaults: defaults)
updateThread(thread, isUnread: false)
NeedsAttentionSnapshotStore.adjustUnreadInboxThreads(by: -1, accountID: accountID)
}
func markThreadUnread(_ thread: InboxThreadSummary) {
- InboxReadStateStore.markUnread(for: thread.id, defaults: defaults)
+ InboxReadStateStore.markUnread(for: thread.threadGroupingKey, defaults: defaults)
updateThread(thread, isUnread: true)
NeedsAttentionSnapshotStore.adjustUnreadInboxThreads(by: 1, accountID: accountID)
}
@@ -111,7 +111,7 @@ final class MailingListDetailViewModel {
let viewedAt = Date()
for thread in unreadThreads {
- InboxReadStateStore.markViewed(max(viewedAt, thread.lastActivityAt), for: thread.id, defaults: defaults)
+ InboxReadStateStore.markViewed(max(viewedAt, thread.lastActivityAt), for: thread.threadGroupingKey, defaults: defaults)
}
threads = threads.map { thread in