summaryrefslogtreecommitdiff
path: root/internal/client/ui/core/chat/chat.go
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2025-02-06 17:22:18 +0200
committerKyren223 <Kyren223@proton.me>2025-02-06 17:22:18 +0200
commit98f29ba812f8ddc0f73ad4b1b02fc31bee42a067 (patch)
treede7bd4ce81f726f19ea7c9c6696eef696c308ed3 /internal/client/ui/core/chat/chat.go
parenta758ca4212a062c1d02b52346329327ae8f2f571 (diff)
Fixed a bug where if you would delete a message that would make the chat
empty, it wouldn't show the empty chat message
Diffstat (limited to 'internal/client/ui/core/chat/chat.go')
-rw-r--r--internal/client/ui/core/chat/chat.go10
1 files changed, 5 insertions, 5 deletions
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 {