cheogram-aapl

created pr with cheogram-aapl/jump-to-unread.1 on 2026-11-16T21:16:13Z · by d7025af3
commented on 2026-11-18T16:35:57Z · by 3c31bc8c
lgtm
cmds
checkout latest patchset:
ssh pr.pico.sh pull cheogram-aapl:jump-to-unread | git am -3
checkout specific patchset revision:
ssh pr.pico.sh pull cheogram-aapl:jump-to-unread [rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh cheogram-aapl:jump-to-unread
add comment to patch request:
ssh pr.pico.sh comment cheogram-aapl:jump-to-unread "lgtm!"

Patchset cheogram-aapl/jump-to-unread.1 on 2026-11-16T21:16:13Z · commit 078a549

Use canReplace
Stephen Paul Weber 2026-11-16T20:05:22Z
Diff stat
App/App.swift | 28 ++++++----------------------
1 file changed, 6 insertions(+), 22 deletions(-)
Semantic diff summary
0 added, 0 modified, 0 signature changed, 0 removed across 0 analyzed files (1 file skipped: unsupported file type)
+6 -22 App/App.swift #
......@@ -424,13 +424,11 @@ class ChatViewModel {
424424
425425 func messageIndex(for message: Borogove.ChatMessage) -> Int? {
426426 messages.firstIndex { m in
427- let dta = messageData[m.id]
428- return
429- (dta?.serverId != nil
430- && dta?.serverId == message.serverId)
431- || (dta?.localId == message.localId
432- && (!message.isIncoming()
433- || message.versions.count > 0))
427+ if let data = messageData[m.id] {
428+ message.canReplace(other: data)
429+ } else {
430+ false
431+ }
434432 }
435433 }
436434
......@@ -487,20 +485,6 @@ class ChatViewModel {
487485 return built
488486 }
489487
490- private func isNewest(
491- _ message: Borogove.ChatMessage,
492- in chat: Borogove.Chat
493- ) -> Bool {
494- guard let last = chat.lastMessage else { return true }
495- if let serverID = message.serverId, let lastServerID = last.serverId {
496- return serverID == lastServerID
497- }
498- if let localID = message.localId, let lastLocalID = last.localId {
499- return localID == lastLocalID
500- }
501- return false
502- }
503-
504488 func markRead(upTo message: Message) {
505489 guard let chat, messageData[message.id] != nil else { return }
506490 // Debounce
......@@ -556,7 +540,7 @@ class ChatViewModel {
556540 isCaughtUpToNewest = exhausted
557541 || messages.last
558542 .flatMap { messageData[$0.id] }
559- .map { isNewest($0, in: chat) } ?? true
543+ .map { chat.lastMessage?.canReplace(other: $0) ?? true } ?? true
560544 }
561545
562546 func jumpToNewest() async {
Back to top