From 2b49d271be7b448a4f56aab1c702ba3ca41b9dc2 Mon Sep 17 00:00:00 2001
From: Ming Rui Zhang <mingrui.zhang@savoirfairelinux.com>
Date: Tue, 8 Dec 2020 10:10:56 -0500
Subject: [PATCH] avatar: generic placeholder should be used if only account
 uri is available

Gitlab: #203
Change-Id: Ia98d4f67cbb3c12d96384f2f3a8e851eeb83750a
---
 src/commoncomponents/AvatarImage.qml | 1 +
 src/utils.cpp                        | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/commoncomponents/AvatarImage.qml b/src/commoncomponents/AvatarImage.qml
index bfd748769..5215b4945 100644
--- a/src/commoncomponents/AvatarImage.qml
+++ b/src/commoncomponents/AvatarImage.qml
@@ -19,6 +19,7 @@
 import QtQuick 2.14
 import QtQuick.Controls 2.14
 import QtQuick.Window 2.14
+import net.jami.Adapters 1.0
 import net.jami.Constants 1.0
 
 Item {
diff --git a/src/utils.cpp b/src/utils.cpp
index 327cdc679..1dc04fada 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -735,7 +735,9 @@ Utils::accountPhoto(const lrc::api::account::Info& accountInfo, const QSize& siz
     } else {
         auto bestId = LRCInstance::accountModel().bestIdForAccount(accountInfo.id);
         auto bestName = LRCInstance::accountModel().bestNameForAccount(accountInfo.id);
-        QString letterStr = bestId == bestName ? QString() : bestName;
+        QString letterStr = (bestId == bestName || bestName == accountInfo.profileInfo.uri)
+                                ? QString()
+                                : bestName;
         QString prefix = accountInfo.profileInfo.type == lrc::api::profile::Type::RING ? "ring:"
                                                                                        : "sip:";
         photo = fallbackAvatar(prefix + accountInfo.profileInfo.uri, letterStr, size);
-- 
GitLab