Commit 605461ff authored by Sébastien Blin's avatar Sébastien Blin Committed by Andreas Traczyk
Browse files

conversationmodel: clean confId and fix selection when ending a call

Change-Id: I8e0e6f0e54a5f537b1719a3e46d452a9db8f2072
parent 716ce26d
......@@ -428,9 +428,17 @@ ConversationModel::selectConversation(const std::string& uid) const
}
auto& conversation = pimpl_->conversations.at(conversationIdx);
if (not conversation.confId.empty()) {
bool callEnded = true;
if (!conversation.callId.empty()) {
try {
auto call = owner.callModel->getCall(conversation.callId);
callEnded = call.status == call::Status::ENDED;
} catch (...) {}
}
if (not callEnded and not conversation.confId.empty()) {
emit pimpl_->behaviorController.showCallView(owner.id, conversation);
} else if (conversation.callId.empty()) {
} else if (callEnded) {
emit pimpl_->behaviorController.showChatView(owner.id, conversation);
} else {
try {
......@@ -1561,7 +1569,9 @@ ConversationModelPimpl::slotCallEnded(const std::string& callId)
for (auto& conversation: conversations)
if (conversation.callId == callId) {
conversation.callId = "";
conversation.confId = ""; // The participant is detached
dirtyConversations = {true, true};
emit linked.conversationUpdated(conversation.uid);
}
} catch (std::out_of_range& e) {
qDebug() << "ConversationModelPimpl::slotCallEnded can't end inexistant call";
......
......@@ -697,7 +697,6 @@ NewCallModelPimpl::slotCallStateChanged(const std::string& callId, const std::st
setCurrentCall(callId);
call->startTime = std::chrono::steady_clock::now();
setCurrentCall(callId);
emit linked.callStarted(callId);
sendProfile(callId);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment