From 42a1ee12c1e64955e6ddd38c34b122c7c10a93f2 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Tue, 4 Feb 2025 16:54:51 +0200 Subject: Fixed crash in user signals --- internal/client/ui/core/chat/chat.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'internal/client/ui/core') 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 } } -- cgit v1.3.1