diff options
author | Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> | 2023-11-06 17:13:51 +0100 |
---|---|---|
committer | Guru <alexandrgproductengine@lindenlab.com> | 2023-11-06 19:40:19 +0100 |
commit | 85c4ea76b9a3193dd338bca5c571b84bebf6b38c (patch) | |
tree | 123361b6de21a0326293ae0b9c5c5f9782583c96 | |
parent | 62f864c04539b0db7069d75f471778b9b77d5b9e (diff) |
SL-20163 Allow residents to hide exact join date on profiles (check server support)
-rw-r--r-- | indra/newview/llavatarpropertiesprocessor.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llavatarpropertiesprocessor.h | 5 | ||||
-rw-r--r-- | indra/newview/llpanelprofile.cpp | 22 |
3 files changed, 23 insertions, 14 deletions
diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index e5e9d817c9..bed8887ce1 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -264,6 +264,8 @@ bool LLAvatarPropertiesProcessor::hasPaymentInfoOnFile(const LLAvatarData* avata // static void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_url, LLUUID avatar_id, EAvatarProcessorType type) { + LLAvatarPropertiesProcessor& inst = instance(); + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("requestAvatarPropertiesCoro", httpPolicy)); @@ -278,7 +280,7 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur LLSD result = httpAdapter->getAndSuspend(httpRequest, finalUrl, httpOpts, httpHeaders); // Response is being processed, no longer pending is required - getInstance()->removePendingRequest(avatar_id, type); + inst.removePendingRequest(avatar_id, type); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -308,7 +310,8 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur avatar_data.born_on = result["member_since"].asDate(); // TODO: SL-20163 Remove the "has" check when SRV-684 is done // and the field "hide_age" is included to the http response - avatar_data.hide_age = !result.has("hide_age") || result["hide_age"].asBoolean(); + inst.mIsHideAgeSupportedByServer = result.has("hide_age"); + avatar_data.hide_age = inst.isHideAgeSupportedByServer() && result["hide_age"].asBoolean(); avatar_data.profile_url = getProfileURL(avatar_id.asString()); avatar_data.customer_type = result["customer_type"].asString(); avatar_data.notes = result["notes"].asString(); @@ -364,7 +367,7 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur avatar_data.picks_list.emplace_back(pick_data["id"].asUUID(), pick_data["name"].asString()); } - getInstance()->notifyObservers(avatar_id, &avatar_data, type); + inst.notifyObservers(avatar_id, &avatar_data, type); } void LLAvatarPropertiesProcessor::processAvatarLegacyPropertiesReply(LLMessageSystem* msg, void**) @@ -384,7 +387,6 @@ void LLAvatarPropertiesProcessor::processAvatarLegacyPropertiesReply(LLMessageSy msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_Flags, avatar_data.flags); LLDateUtil::dateFromPDTString(avatar_data.born_on, birth_date); - // Since field 'hide_age' is not supported by msg system we'd better hide the age here avatar_data.caption_index = 0; S32 charter_member_size = 0; diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h index 1bf07704a9..99ed110487 100644 --- a/indra/newview/llavatarpropertiesprocessor.h +++ b/indra/newview/llavatarpropertiesprocessor.h @@ -217,6 +217,8 @@ public: void sendClassifiedDelete(const LLUUID& classified_id); + bool isHideAgeSupportedByServer() { return mIsHideAgeSupportedByServer; } + // Returns translated, human readable string for account type, such // as "Resident" or "Linden Employee". Used for profiles, inspectors. static std::string accountType(const LLAvatarData* avatar_data); @@ -274,6 +276,9 @@ protected: // Map avatar_id+request_type -> U32 timestamp in seconds typedef std::map< std::pair<LLUUID, EAvatarProcessorType>, U32> timestamp_map_t; timestamp_map_t mRequestTimestamps; + + // Is returned by isHideAgeSupportedByServer() + bool mIsHideAgeSupportedByServer { false }; }; #endif // LL_LLAVATARPROPERTIESPROCESSOR_H diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index eb62627278..c564b86c60 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -710,7 +710,7 @@ BOOL LLPanelProfileSecondLife::postBuild() { mGroupList = getChild<LLGroupList>("group_list"); mShowInSearchCombo = getChild<LLComboBox>("show_in_search"); - mHideAgeCombo = getChild<LLComboBox>("hide_age"); + mHideAgeCombo = getChild<LLComboBox>("hide_age"); mSecondLifePic = getChild<LLThumbnailCtrl>("2nd_life_pic"); mSecondLifePicLayout = getChild<LLPanel>("image_panel"); mDescriptionEdit = getChild<LLTextEditor>("sl_description_edit"); @@ -1173,20 +1173,22 @@ void LLPanelProfileSecondLife::fillAgeData(const LLAvatarData* avatar_data) userAgeCtrl->setValue(register_date); } + BOOL showHideAgeCombo = FALSE; if (getSelfProfile()) { - F64 birth = avatar_data->born_on.secondsSinceEpoch(); - F64 now = LLDate::now().secondsSinceEpoch(); - if (now - birth > 365 * 24 * 60 * 60) + if (LLAvatarPropertiesProcessor::getInstance()->isHideAgeSupportedByServer()) { - mHideAge = avatar_data->hide_age; - mHideAgeCombo->setValue(mHideAge ? TRUE : FALSE); - } - else - { - mHideAgeCombo->setVisible(FALSE); + F64 birth = avatar_data->born_on.secondsSinceEpoch(); + F64 now = LLDate::now().secondsSinceEpoch(); + if (now - birth > 365 * 24 * 60 * 60) + { + mHideAge = avatar_data->hide_age; + mHideAgeCombo->setValue(mHideAge ? TRUE : FALSE); + showHideAgeCombo = TRUE; + } } } + mHideAgeCombo->setVisible(showHideAgeCombo); } void LLPanelProfileSecondLife::onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep) |