A chat might become visible after first discovery

This commit is contained in:
Sebastian Wolf 2021-05-26 21:53:10 +02:00
parent b350487fb9
commit 136e4328d7
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
3 changed files with 9 additions and 3 deletions

View file

@ -12,7 +12,7 @@ Name: harbour-fernschreiber
Summary: Fernschreiber is a Telegram client for Sailfish OS
Version: 0.9
Release: 1
Release: 2
Group: Qt/Qt
License: LICENSE
URL: http://werkwolf.eu/

View file

@ -1,7 +1,7 @@
Name: harbour-fernschreiber
Summary: Fernschreiber is a Telegram client for Sailfish OS
Version: 0.9
Release: 1
Release: 2
# The contents of the Group field should be one of the groups listed here:
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS
Group: Qt/Qt

View file

@ -674,7 +674,7 @@ void ChatListModel::handleChatDiscovered(const QString &, const QVariantMap &cha
}
}
if (chat->isHidden()) {
if (chat->isHidden() && !showHiddenChats) {
LOG("Hidden chat" << chat->chatId);
hiddenChats.insert(chat->chatId, chat);
} else {
@ -708,6 +708,12 @@ void ChatListModel::handleChatLastMessageUpdated(const QString &id, const QStrin
LOG("Updating last message for hidden chat" << chatId << "new order" << order);
chat->setOrder(order);
chat->chatData.insert(LAST_MESSAGE, lastMessage);
// A chat can become visible (e.g. when a known contact joins Telegram)
// When the private chat is discovered it doesn't have any messages, now it could be there...
if (!chat->isHidden() || showHiddenChats) {
hiddenChats.remove(chatId);
addVisibleChat(chat);
}
}
}
}