From 0f2936571157fad8a721a12424efc288a5e60c4e Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 18 Dec 2023 19:15:23 +0100 Subject: [PATCH] Restore fix for SL-18058 --- indra/newview/llpanelavatar.cpp | 15 +++++++++++---- indra/newview/llpanelavatar.h | 2 +- indra/newview/llpanelprofile.cpp | 12 +++++++++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 24ca55c9b5..2d862b235a 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -143,7 +143,7 @@ void LLPanelProfileTab::setApplyProgress(bool started) } } -static void put_avatar_properties_coro(std::string cap_url, LLUUID agent_id, LLSD data) +static void put_avatar_properties_coro(std::string cap_url, LLUUID agent_id, LLSD data, std::function callback) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -166,11 +166,18 @@ static void put_avatar_properties_coro(std::string cap_url, LLUUID agent_id, LLS LL_WARNS("AvatarProperties") << "Failed to put agent information " << data << " for id " << agent_id << LL_ENDL; return; } + else + { + LL_DEBUGS("AvatarProperties") << "Agent id: " << agent_id << " Data: " << data << " Result: " << httpResults << LL_ENDL; + } - LL_DEBUGS("AvatarProperties") << "Agent id: " << agent_id << " Data: " << data << " Result: " << httpResults << LL_ENDL; + if (callback) + { + callback(status); + } } -bool LLPanelProfileTab::saveAgentUserInfoCoro(std::string name, LLSD value) const +bool LLPanelProfileTab::saveAgentUserInfoCoro(std::string name, LLSD value, std::function callback) const { std::string cap_url = gAgent.getRegionCapability("AgentProfile"); if (cap_url.empty()) @@ -180,7 +187,7 @@ bool LLPanelProfileTab::saveAgentUserInfoCoro(std::string name, LLSD value) cons } LLCoros::instance().launch("putAgentUserInfoCoro", - boost::bind(put_avatar_properties_coro, cap_url, getAvatarId(), LLSD().with(name, value))); + boost::bind(put_avatar_properties_coro, cap_url, getAvatarId(), LLSD().with(name, value), callback)); return true; } diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index 1106c44734..ec620b39e1 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -133,7 +133,7 @@ protected: const bool getSelfProfile() const { return mSelfProfile; } - bool saveAgentUserInfoCoro(std::string name, LLSD value) const; + bool saveAgentUserInfoCoro(std::string name, LLSD value, std::function callback = nullptr) const; public: void setIsLoading() { mLoadingState = PROFILE_LOADING; } diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index b201342ef0..26117103ad 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -2393,7 +2393,17 @@ void LLPanelProfileSecondLife::onCommitProfileImage(const LLUUID& id) if (!gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP).empty()) { - if (!saveAgentUserInfoCoro("sl_image_id", id)) + std::function callback = [id](bool result) + { + if (result) + { + LLAvatarIconIDCache::getInstance()->add(gAgentID, id); + // Should trigger callbacks in icon controls + LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(gAgentID); + } + }; + + if (!saveAgentUserInfoCoro("sl_image_id", id, callback)) return; mImageId = id;