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,15 +1743,19 @@ 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 {
var isPeerJoined = false if let firstEntry = historyView.originalView.entries.first {
for media in firstEntry.message.media { var isPeerJoined = false
if let action = media as? TelegramMediaAction, action.action == .peerJoined { for media in firstEntry.message.media {
isPeerJoined = true if let action = media as? TelegramMediaAction, action.action == .peerJoined {
break isPeerJoined = true
break
}
} }
loadState = .empty(isPeerJoined ? .joined : .generic)
} else {
loadState = .empty(.generic)
} }
loadState = .empty(isPeerJoined ? .joined : .generic)
} else { } else {
loadState = .messages loadState = .messages
} }