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

contactmodel: avoid unnecessary logic at presentation

Have the bestIdForContact method return an empty string if it is the
same as bestNameForContact, similar to bestIdForAccount.

Change-Id: I6a5c7a5fc5e72c4a927b6fb40bd55389fb7a27a4
parent 16b8c6c4
No related branches found
No related tags found
No related merge requests found
......@@ -520,19 +520,24 @@ ContactModel::bestNameForContact(const QString& contactUri) const
qDebug() << "ContactModel::bestNameForContact" << e.what();
}
return QString();
return {};
}
const QString
ContactModel::bestIdForContact(const QString& contactUri) const
{
try {
return bestIdFromContactInfo(getContact(contactUri));
auto contact = getContact(contactUri);
auto alias = contact.profileInfo.alias.simplified();
if (alias.isEmpty()) {
return {};
}
return bestIdFromContactInfo(contact);
} catch (const std::out_of_range& e) {
qDebug() << "ContactModel::bestIdForContact" << e.what();
}
return QString();
return {};
}
const QString
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment