summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2023-12-18 22:02:14 +0200
committerAndrey Lihatskiy <alihatskiy@productengine.com>2023-12-18 22:02:14 +0200
commit7838c14d871529b39e0fdf63088ac7640478605c (patch)
treea4db120e5abba5ad9b1981b12870159d56b8eed8 /indra/newview
parentc87850ddab5604e57fdcebad6a53616232a1b648 (diff)
SL-18058 Post-merge functionality restore
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanelavatar.cpp16
-rw-r--r--indra/newview/llpanelavatar.h2
-rw-r--r--indra/newview/llpanelprofile.cpp51
3 files changed, 23 insertions, 46 deletions
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index ad8ed7c144..3f2dc5a415 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -127,7 +127,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<void(bool)> callback)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
@@ -148,13 +148,19 @@ static void put_avatar_properties_coro(std::string cap_url, LLUUID agent_id, LLS
if (!status)
{
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<void(bool)> callback) const
{
std::string cap_url = gAgent.getRegionCapability("AgentProfile");
if (cap_url.empty())
@@ -164,7 +170,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<void(bool)> callback = nullptr) const;
public:
void setIsLoading() { mLoadingState = PROFILE_LOADING; }
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index 6067f9c299..f014dff470 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -102,45 +102,6 @@ static const std::string PROFILE_IMAGE_UPLOAD_CAP = "UploadAgentProfileImage";
//////////////////////////////////////////////////////////////////////////
-
-//TODO: changes take two minutes to propagate!
-// Add some storage that holds updated data for two minutes
-// for new instances to reuse the data
-// Profile data is only relevant to own avatar, but notes
-// are for everybody (no onger an issue?)
-void put_avatar_properties_coro(std::string cap_url, LLUUID agent_id, LLSD data, std::function<void(bool)> callback)
-{
- LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
- LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
- httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("put_avatar_properties_coro", httpPolicy));
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
- LLCore::HttpHeaders::ptr_t httpHeaders;
-
- LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
- httpOpts->setFollowRedirects(true);
-
- std::string finalUrl = cap_url + "/" + agent_id.asString();
-
- LLSD result = httpAdapter->putAndSuspend(httpRequest, finalUrl, data, httpOpts, httpHeaders);
-
- LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
- LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
-
- if (!status)
- {
- LL_WARNS("AvatarProperties") << "Failed to put agent information " << data << " for id " << agent_id << LL_ENDL;
- }
- else
- {
- LL_DEBUGS("AvatarProperties") << "Agent id: " << agent_id << " Data: " << data << " Result: " << httpResults << LL_ENDL;
- }
-
- if (callback)
- {
- callback(status);
- }
-}
-
LLUUID post_profile_image(std::string cap_url, const LLSD &first_data, std::string path_to_image, LLHandle<LLPanel> *handle)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
@@ -1840,7 +1801,17 @@ void LLPanelProfileSecondLife::onCommitProfileImage(const LLUUID& id)
if (mImageId == id)
return;
- if (!saveAgentUserInfoCoro("sl_image_id", id))
+ std::function<void(bool)> 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;