summaryrefslogtreecommitdiff
path: root/internal/client/ui/core/chat
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2025-02-04 16:54:51 +0200
committerKyren223 <Kyren223@proton.me>2025-02-04 16:54:51 +0200
commit42a1ee12c1e64955e6ddd38c34b122c7c10a93f2 (patch)
treef7f6e11475e8b05c13f8f7777859c2236c5101c1 /internal/client/ui/core/chat
parente3b22023d835081f2b19dae6dcb78c9603cc7cb7 (diff)
Fixed crash in user signals
Diffstat (limited to 'internal/client/ui/core/chat')
-rw-r--r--internal/client/ui/core/chat/chat.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/internal/client/ui/core/chat/chat.go b/internal/client/ui/core/chat/chat.go
index 9451de7..10c7b99 100644
--- a/internal/client/ui/core/chat/chat.go
+++ b/internal/client/ui/core/chat/chat.go
@@ -266,16 +266,16 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
}
lastMsg := state.GetLastMessage(receiverId)
- if m.base == SnapToBottom && lastMsg != nil {
+ if m.base != SnapToBottom {
+ m.keepLastRead = false
+ } else if lastMsg != nil {
lastReadMsg := state.Data.LastReadMessage[receiverId]
+ if m.keepLastRead && m.lastReadMsg != nil && lastReadMsg != nil &&
+ *lastReadMsg != *lastMsg && *lastReadMsg != *m.lastReadMsg {
+ m.keepLastRead = false
+ }
- // if m.lastReadMsg != nil && lastReadMsg != nil &&
- // *lastReadMsg != *lastMsg &&
- // *lastReadMsg != *m.lastReadMsg {
- // m.keepLastRead = false
- // }
-
- *lastReadMsg = *lastMsg
+ state.Data.LastReadMessage[receiverId] = lastMsg
}
}