Fix empty chat node

This commit is contained in:
Ilya Laktyushin 2021-01-25 00:13:23 +03:00
parent a3b8870065
commit c522d7f67d

View File

@ -1743,7 +1743,8 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
let loadState: ChatHistoryNodeLoadState let loadState: ChatHistoryNodeLoadState
if let historyView = strongSelf.historyView { if let historyView = strongSelf.historyView {
if let firstEntry = historyView.originalView.entries.first, historyView.filteredEntries.isEmpty { if historyView.filteredEntries.isEmpty {
if let firstEntry = historyView.originalView.entries.first {
var isPeerJoined = false var isPeerJoined = false
for media in firstEntry.message.media { for media in firstEntry.message.media {
if let action = media as? TelegramMediaAction, action.action == .peerJoined { if let action = media as? TelegramMediaAction, action.action == .peerJoined {
@ -1752,6 +1753,9 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
} }
} }
loadState = .empty(isPeerJoined ? .joined : .generic) loadState = .empty(isPeerJoined ? .joined : .generic)
} else {
loadState = .empty(.generic)
}
} else { } else {
loadState = .messages loadState = .messages
} }