From 136e4328d701a3d0e6f1a367a8443b60f74e41f8 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Wed, 26 May 2021 21:53:10 +0200 Subject: [PATCH] A chat might become visible after first discovery --- rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- src/chatlistmodel.cpp | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index a16e357..8c7b527 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -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/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 689fdf2..56624f1 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -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 diff --git a/src/chatlistmodel.cpp b/src/chatlistmodel.cpp index 94719c7..cb3ae62 100644 --- a/src/chatlistmodel.cpp +++ b/src/chatlistmodel.cpp @@ -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); + } } } }