1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-04 14:55:43 +02:00

currentconversation: always set the current conversation id

This must be done even when empty and contributes to the deselection mechanism.

Change-Id: Ia97186ad8f37763ed2c8f61f4f44a0a04df7577b
This commit is contained in:
Andreas Traczyk 2023-03-01 13:22:32 -05:00
parent 7a844ee1ae
commit 84d625c1b4

View file

@ -51,12 +51,18 @@ void
CurrentConversation::updateData() CurrentConversation::updateData()
{ {
auto convId = lrcInstance_->get_selectedConvUid(); auto convId = lrcInstance_->get_selectedConvUid();
if (convId.isEmpty())
return; auto cleanup = qScopeGuard([&] {
set_id(convId);
updateErrors(convId);
});
try { try {
auto accountId = lrcInstance_->get_currentAccountId(); auto accountId = lrcInstance_->get_currentAccountId();
const auto& accInfo = lrcInstance_->accountModel().getAccountInfo(accountId); const auto& accInfo = lrcInstance_->accountModel().getAccountInfo(accountId);
if (auto optConv = accInfo.conversationModel->getConversationForUid(convId)) { auto optConv = accInfo.conversationModel->getConversationForUid(convId);
if (!optConv)
return;
auto& convInfo = optConv->get(); auto& convInfo = optConv->get();
set_lastSelfMessageId(convInfo.lastSelfMessageId); set_lastSelfMessageId(convInfo.lastSelfMessageId);
QStringList uris, bannedUris; QStringList uris, bannedUris;
@ -93,8 +99,7 @@ CurrentConversation::updateData()
set_callState(call::Status::INVALID); set_callState(call::Status::INVALID);
set_hasCall(false); set_hasCall(false);
} }
set_inCall(callState_ == call::Status::CONNECTED set_inCall(callState_ == call::Status::CONNECTED || callState_ == call::Status::IN_PROGRESS
|| callState_ == call::Status::IN_PROGRESS
|| callState_ == call::Status::PAUSED); || callState_ == call::Status::PAUSED);
// The temporary status is only for dialogs. // The temporary status is only for dialogs.
@ -102,8 +107,7 @@ CurrentConversation::updateData()
// is consistently determined by the peer's uri being equal to // is consistently determined by the peer's uri being equal to
// the conversation id. // the conversation id.
auto members = accInfo.conversationModel->peersForConversation(convId); auto members = accInfo.conversationModel->peersForConversation(convId);
set_isTemporary(isCoreDialog_ ? (convId == members.at(0) || convId == "SEARCHSIP") set_isTemporary(isCoreDialog_ ? (convId == members.at(0) || convId == "SEARCHSIP") : false);
: false);
auto isContact {false}; auto isContact {false};
if (isCoreDialog_) if (isCoreDialog_)
@ -128,12 +132,9 @@ CurrentConversation::updateData()
onProfileUpdated(convId); onProfileUpdated(convId);
updateActiveCalls(accountId, convId); updateActiveCalls(accountId, convId);
}
} catch (...) { } catch (...) {
qWarning() << "Can't update current conversation data for" << convId; qWarning() << "Can't update current conversation data for" << convId;
} }
set_id(convId);
updateErrors(convId);
} }
void void
@ -304,7 +305,7 @@ CurrentConversation::showSwarmDetails()
void void
CurrentConversation::updateErrors(const QString& convId) CurrentConversation::updateErrors(const QString& convId)
{ {
if (convId != id_) if (convId != id_ || convId.isEmpty())
return; return;
try { try {
QStringList newErrors; QStringList newErrors;