Skip to content
Snippets Groups Projects
Commit 9e12d838 authored by Andreas Traczyk's avatar Andreas Traczyk
Browse files

contactmodel: include search results when finding a contact name

Since we display the title in the smartlist now, we need to check
the search result list in the case where the contact is not found
when acquiring a best-name.

Change-Id: Iee808b7137edfb6265e8ad4491c8354e3fcd9bcf
parent 492ff0fe
Branches
Tags
No related merge requests found
...@@ -523,14 +523,14 @@ ContactModel::sendDhtMessage(const QString& contactUri, const QString& body) con ...@@ -523,14 +523,14 @@ ContactModel::sendDhtMessage(const QString& contactUri, const QString& body) con
const QString const QString
ContactModel::bestNameForContact(const QString& contactUri) const ContactModel::bestNameForContact(const QString& contactUri) const
{ {
std::lock_guard<std::mutex> lk(pimpl_->contactsMtx_); try {
if (pimpl_->contacts.contains(contactUri)) { auto contact = getContact(contactUri);
auto contact = pimpl_->contacts.value(contactUri);
auto alias = contact.profileInfo.alias.simplified(); auto alias = contact.profileInfo.alias.simplified();
if (alias.isEmpty()) { if (alias.isEmpty()) {
return bestIdFromContactInfo(contact); return bestIdFromContactInfo(contact);
} }
return alias; return alias;
} catch(const std::out_of_range&) {
} }
return contactUri; return contactUri;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment