From 98f29ba812f8ddc0f73ad4b1b02fc31bee42a067 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Thu, 6 Feb 2025 17:22:18 +0200 Subject: Fixed a bug where if you would delete a message that would make the chat empty, it wouldn't show the empty chat message --- internal/client/ui/core/chat/chat.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'internal/client/ui') diff --git a/internal/client/ui/core/chat/chat.go b/internal/client/ui/core/chat/chat.go index 5a49a7f..da561f6 100644 --- a/internal/client/ui/core/chat/chat.go +++ b/internal/client/ui/core/chat/chat.go @@ -902,6 +902,10 @@ func (m *Model) renderMessageBox() string { } func (m *Model) renderMessages(screenHeight int) string { + if !m.hasReadAccess { + return NoAccess.Width(m.width).Height(screenHeight).String() + "\n" + } + var id *snowflake.ID var btree *btree.BTreeG[data.Message] networkId := state.NetworkId(m.networkIndex) @@ -916,11 +920,7 @@ func (m *Model) renderMessages(screenHeight int) string { btree = state.State.Messages[receiverId] } - if !m.hasReadAccess { - return NoAccess.Width(m.width).Height(screenHeight).String() + "\n" - } - - if btree == nil || id == nil { + if btree == nil || btree.Len() == 0 || id == nil { if m.frequencyIndex != -1 { return NoMessagesFrequency.Width(m.width).Height(screenHeight).String() + "\n" } else if m.receiverIndex != -1 { -- cgit v1.3.1