1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-04-21 21:52:03 +02:00

contactmodel: fix account avatar on link device

We do not need to write an empty profile since the daemon fully
manages the profile. Just update it from cache when new profile
is detected

GitLab: #1627
Change-Id: I31035f0666925d13f339f387e614f148b0eece8b
This commit is contained in:
Sébastien Blin 2024-05-27 14:21:03 -04:00
parent acc0c97234
commit e56a966de1
4 changed files with 9 additions and 59 deletions

View file

@ -166,17 +166,6 @@ public Q_SLOTS:
* @param ok
*/
void slotMigrationEnded(const QString& accountId, bool ok);
/**
* Emit accountProfileReceived
* @param accountId
* @param displayName
* @param userPhoto
*/
void slotAccountProfileReceived(const QString& accountId,
const QString& displayName,
const QString& userPhoto);
/**
* Emit new position
* @param accountId
@ -415,10 +404,6 @@ AccountModelPimpl::AccountModelPimpl(AccountModel& linked,
&CallbacksHandler::migrationEnded,
this,
&AccountModelPimpl::slotMigrationEnded);
connect(&callbacksHandler,
&CallbacksHandler::accountProfileReceived,
this,
&AccountModelPimpl::slotAccountProfileReceived);
connect(&callbacksHandler,
&CallbacksHandler::newPosition,
this,
@ -691,25 +676,6 @@ AccountModelPimpl::slotMigrationEnded(const QString& accountId, bool ok)
Q_EMIT linked.migrationEnded(accountId, ok);
}
void
AccountModelPimpl::slotAccountProfileReceived(const QString& accountId,
const QString& displayName,
const QString& userPhoto)
{
LC_WARN << accountId << displayName;
auto account = accounts.find(accountId);
if (account == accounts.end())
return;
auto& accountInfo = account->second.first;
accountInfo.profileInfo.avatar = userPhoto;
accountInfo.profileInfo.alias = displayName;
storage::vcard::setProfile(accountInfo.id, accountInfo.profileInfo);
Q_EMIT linked.profileUpdated(accountId);
}
void
AccountModelPimpl::slotNewPosition(const QString& accountId,
const QString& peerId,

View file

@ -236,13 +236,6 @@ CallbacksHandler::CallbacksHandler(const Lrc& parent)
this,
&CallbacksHandler::slotDeviceRevokationEnded,
Qt::QueuedConnection);
connect(&ConfigurationManager::instance(),
&ConfigurationManagerInterface::accountProfileReceived,
this,
&CallbacksHandler::slotAccountProfileReceived,
Qt::QueuedConnection);
connect(&ConfigurationManager::instance(),
&ConfigurationManagerInterface::exportOnRingEnded,
this,
@ -671,14 +664,6 @@ CallbacksHandler::slotDeviceRevokationEnded(const QString& accountId,
Q_EMIT deviceRevocationEnded(accountId, deviceId, status);
}
void
CallbacksHandler::slotAccountProfileReceived(const QString& accountId,
const QString& displayName,
const QString& userPhoto)
{
Q_EMIT accountProfileReceived(accountId, displayName, userPhoto);
}
void
CallbacksHandler::slotExportOnRingEnded(const QString& accountId, int status, const QString& pin)
{

View file

@ -562,16 +562,6 @@ private Q_SLOTS:
const QString& deviceId,
const int status);
/**
* Emit account avatar has been received
* @param accountId
* @param displayName
* @param userPhoto
*/
void slotAccountProfileReceived(const QString& accountId,
const QString& displayName,
const QString& userPhoto);
/**
* Emit exportOnRingEnded
* @param accountId

View file

@ -1175,6 +1175,15 @@ ContactModelPimpl::slotProfileReceived(const QString& accountId,
if (accountId != linked.owner.id)
return;
if (linked.owner.profileInfo.uri == peer) {
const auto newProfileInfo = storage::getProfileData(accountId, "");
linked.owner.accountModel->setAlias(accountId, newProfileInfo["alias"], false);
linked.owner.accountModel->setAvatar(accountId, newProfileInfo["avatar"], false);
Q_EMIT linked.owner.accountModel->profileUpdated(accountId);
return;
}
// Make sure this is for a contact and not the linked account,
// then just remove the URI from the cache list and notify.
std::lock_guard<std::mutex> lk(contactsMtx_);