From 93cde493d8a2c6161debf61db965ef68ecb90425 Mon Sep 17 00:00:00 2001
From: Andreas Hatziiliou <andreas.hatziiliou@savoirfairelinux.com>
Date: Mon, 7 Oct 2024 16:21:33 -0400
Subject: [PATCH] user_search: fix issue with user display incorrectly being
 updated

When searching for a user, if the user was found, a signal would be
sent to update the display name with incorrect formatting across the
application.

Change-Id: I20a453e2eddf1e1a402985ff741c8e7c7ea6f99f
---
 src/libclient/contactmodel.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/libclient/contactmodel.cpp b/src/libclient/contactmodel.cpp
index e3673d484..72fe3efa1 100644
--- a/src/libclient/contactmodel.cpp
+++ b/src/libclient/contactmodel.cpp
@@ -240,7 +240,8 @@ ContactModel::ContactModel(const account::Info& owner,
 ContactModel::~ContactModel() {}
 
 void
-ContactModel::initContacts() {
+ContactModel::initContacts()
+{
     pimpl_->fillWithJamiContacts();
 }
 
@@ -944,20 +945,21 @@ ContactModelPimpl::slotRegisteredNameFound(const QString& accountId,
         return;
 
     if (status == 0 /* SUCCESS */) {
+        QString foundName = registeredName.toLower();
         std::lock_guard<std::mutex> lk(contactsMtx_);
         if (contacts.find(uri) != contacts.end()) {
             // update contact and remove temporary item
-            contacts[uri].registeredName = registeredName;
+            contacts[uri].registeredName = foundName;
             searchResult.clear();
         } else {
-            nonContactLookup_[uri] = registeredName;
+            nonContactLookup_[uri] = foundName;
             if ((searchQuery != uri && searchQuery != registeredName) || searchQuery.isEmpty()) {
                 // we are notified that a previous lookup ended
                 return;
             }
             // Update the temporary item
             lrc::api::profile::Info profileInfo = {uri, "", "", profile::Type::TEMPORARY};
-            searchResult[uri] = {profileInfo, registeredName, false, false};
+            searchResult[uri] = {profileInfo, foundName, false, false};
         }
     } else {
         {
-- 
GitLab