From 7621b342733d0d28c4bf4ca84f8a671b6a07b6bb Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Fri, 18 Jan 2019 18:19:27 +0200 Subject: [PATCH 1/2] SL-1942 Fixed the estate list change Confirmation messages to show agent names properly --- indra/newview/llfloaterregioninfo.cpp | 64 ++++++++++++++++----------- indra/newview/llfloaterregioninfo.h | 2 +- 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 970bbe6c89..eb48bf8c1c 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -1696,11 +1696,13 @@ struct LLEstateAccessChangeInfo LLSD sd; sd["name"] = mDialogName; sd["operation"] = (S32)mOperationFlag; - for (uuid_vec_t::const_iterator it = mAgentOrGroupIDs.begin(); - it != mAgentOrGroupIDs.end(); - ++it) + for (U32 i = 0; i < mAgentOrGroupIDs.size(); ++i) { - sd["allowed_ids"].append(*it); + sd["allowed_ids"].append(mAgentOrGroupIDs[i]); + if (mAgentNames.size() > i) + { + sd["allowed_names"].append(mAgentNames[i].asLLSD()); + } } return sd; } @@ -1708,6 +1710,7 @@ struct LLEstateAccessChangeInfo U32 mOperationFlag; // ESTATE_ACCESS_BANNED_AGENT_ADD, _REMOVE, etc. std::string mDialogName; uuid_vec_t mAgentOrGroupIDs; // List of agent IDs to apply to this change + std::vector mAgentNames; // Optional list of the agent names for notifications }; // static @@ -3597,7 +3600,7 @@ bool LLPanelEstateAccess::accessAddCore2(const LLSD& notification, const LLSD& r } // avatar picker yes multi-select, yes close-on-select - LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateAccess::accessAddCore3, _1, (void*)change_info), + LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateAccess::accessAddCore3, _1, _2, (void*)change_info), TRUE, TRUE, FALSE, parent_floater_name, button); //Allows the closed parent floater to close the child floater (avatar picker) @@ -3610,7 +3613,7 @@ bool LLPanelEstateAccess::accessAddCore2(const LLSD& notification, const LLSD& r } // static -void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data) +void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, std::vector names, void* data) { LLEstateAccessChangeInfo* change_info = (LLEstateAccessChangeInfo*)data; if (!change_info) return; @@ -3646,11 +3649,12 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data) } uuid_vec_t ids_allowed; + std::vector names_allowed; std::string already_allowed; bool single = true; - for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) + for (U32 i = 0; i < ids.size(); ++i) { - LLScrollListItem* item = name_list->getNameItemByAgentId(*it); + LLScrollListItem* item = name_list->getNameItemByAgentId(ids[i]); if (item) { if (!already_allowed.empty()) @@ -3662,7 +3666,8 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data) } else { - ids_allowed.push_back(*it); + ids_allowed.push_back(ids[i]); + names_allowed.push_back(names[i]); } } if (!already_allowed.empty()) @@ -3678,6 +3683,7 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data) } } change_info->mAgentOrGroupIDs = ids_allowed; + change_info->mAgentNames = names_allowed; } if (change_info->mOperationFlag & ESTATE_ACCESS_BANNED_AGENT_ADD) { @@ -3697,13 +3703,14 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data) } uuid_vec_t ids_allowed; + std::vector names_allowed; std::string already_banned; std::string em_ban; bool single = true; - for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) + for (U32 i = 0; i < ids.size(); ++i) { bool is_allowed = true; - LLScrollListItem* em_item = em_list->getNameItemByAgentId(*it); + LLScrollListItem* em_item = em_list->getNameItemByAgentId(ids[i]); if (em_item) { if (!em_ban.empty()) @@ -3714,7 +3721,7 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data) is_allowed = false; } - LLScrollListItem* item = name_list->getNameItemByAgentId(*it); + LLScrollListItem* item = name_list->getNameItemByAgentId(ids[i]); if (item) { if (!already_banned.empty()) @@ -3728,7 +3735,8 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data) if (is_allowed) { - ids_allowed.push_back(*it); + ids_allowed.push_back(ids[i]); + names_allowed.push_back(names[i]); } } if (!em_ban.empty()) @@ -3755,6 +3763,7 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data) } } change_info->mAgentOrGroupIDs = ids_allowed; + change_info->mAgentNames = names_allowed; } LLSD args; @@ -3877,12 +3886,9 @@ bool LLPanelEstateAccess::accessCoreConfirm(const LLSD& notification, const LLSD std::string names; U32 listed_names = 0; - LLSD::array_const_iterator end_it = notification["payload"]["allowed_ids"].endArray(); - for (LLSD::array_const_iterator iter = notification["payload"]["allowed_ids"].beginArray(); - iter != end_it; - iter++) + for (U32 i = 0; i < notification["payload"]["allowed_ids"].size(); ++i) { - if (iter + 1 != end_it) + if (i + 1 != notification["payload"]["allowed_ids"].size()) { flags |= ESTATE_ACCESS_NO_REPLY; } @@ -3891,7 +3897,7 @@ bool LLPanelEstateAccess::accessCoreConfirm(const LLSD& notification, const LLSD flags &= ~ESTATE_ACCESS_NO_REPLY; } - const LLUUID id = iter->asUUID(); + const LLUUID id = notification["payload"]["allowed_ids"][i].asUUID(); if (((U32)notification["payload"]["operation"].asInteger() & ESTATE_ACCESS_BANNED_AGENT_ADD) && region && (region->getOwner() == id)) { @@ -3906,15 +3912,23 @@ bool LLPanelEstateAccess::accessCoreConfirm(const LLSD& notification, const LLSD // fill the name list for confirmation if (listed_names < MAX_LISTED_NAMES) { - LLAvatarName av_name; - if (LLAvatarNameCache::get(id, &av_name)) + if (!names.empty()) { - if (!names.empty()) + names += ", "; + } + if (!notification["payload"]["allowed_names"][i]["display_name"].asString().empty()) + { + names += notification["payload"]["allowed_names"][i]["display_name"].asString(); + } + else + { //try to get an agent name from cache + LLAvatarName av_name; + if (LLAvatarNameCache::get(id, &av_name)) { - names += ", "; + names += av_name.getCompleteName(); } - names += av_name.getCompleteName(); - } + } + } listed_names++; } diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index e2453181d2..d0b978e38e 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -532,7 +532,7 @@ private: // Core methods for all above add/remove button clicks static void accessAddCore(U32 operation_flag, const std::string& dialog_name); static bool accessAddCore2(const LLSD& notification, const LLSD& response); - static void accessAddCore3(const uuid_vec_t& ids, void* data); + static void accessAddCore3(const uuid_vec_t& ids, std::vector names, void* data); static void accessRemoveCore(U32 operation_flag, const std::string& dialog_name, const std::string& list_ctrl_name); static bool accessRemoveCore2(const LLSD& notification, const LLSD& response); From 3e0e141b7651a8ed20ec310fa4557d2a5c9fcd89 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Thu, 7 Feb 2019 21:59:13 +0200 Subject: [PATCH 2/2] SL-1036 Update estate access lists on the agent's access level change --- indra/newview/llfloaterregioninfo.cpp | 25 ++++++++++++++++--------- indra/newview/llfloaterregioninfo.h | 1 + 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index eb48bf8c1c..ec934a4732 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3339,34 +3339,41 @@ void LLPanelEstateAccess::updateControls(LLViewerRegion* region) BOOL god = gAgent.isGodlike(); BOOL owner = (region && (region->getOwner() == gAgent.getID())); BOOL manager = (region && region->isEstateManager()); - setCtrlsEnabled(god || owner || manager); + BOOL enable_cotrols = god || owner || manager; + setCtrlsEnabled(enable_cotrols); BOOL has_allowed_avatar = getChild("allowed_avatar_name_list")->getFirstSelected() ? TRUE : FALSE; BOOL has_allowed_group = getChild("allowed_group_name_list")->getFirstSelected() ? TRUE : FALSE; BOOL has_banned_agent = getChild("banned_avatar_name_list")->getFirstSelected() ? TRUE : FALSE; BOOL has_estate_manager = getChild("estate_manager_name_list")->getFirstSelected() ? TRUE : FALSE; - getChildView("add_allowed_avatar_btn")->setEnabled(god || owner || manager); - getChildView("remove_allowed_avatar_btn")->setEnabled(has_allowed_avatar && (god || owner || manager)); - getChildView("allowed_avatar_name_list")->setEnabled(god || owner || manager); + getChildView("add_allowed_avatar_btn")->setEnabled(enable_cotrols); + getChildView("remove_allowed_avatar_btn")->setEnabled(has_allowed_avatar && enable_cotrols); + getChildView("allowed_avatar_name_list")->setEnabled(enable_cotrols); - getChildView("add_allowed_group_btn")->setEnabled(god || owner || manager); - getChildView("remove_allowed_group_btn")->setEnabled(has_allowed_group && (god || owner || manager)); - getChildView("allowed_group_name_list")->setEnabled(god || owner || manager); + getChildView("add_allowed_group_btn")->setEnabled(enable_cotrols); + getChildView("remove_allowed_group_btn")->setEnabled(has_allowed_group && enable_cotrols); + getChildView("allowed_group_name_list")->setEnabled(enable_cotrols); // Can't ban people from mainland, orientation islands, etc. because this // creates much network traffic and server load. // Disable their accounts in CSR tool instead. bool linden_estate = LLPanelEstateInfo::isLindenEstate(); - bool enable_ban = (god || owner || manager) && !linden_estate; + bool enable_ban = enable_cotrols && !linden_estate; getChildView("add_banned_avatar_btn")->setEnabled(enable_ban); getChildView("remove_banned_avatar_btn")->setEnabled(has_banned_agent && enable_ban); - getChildView("banned_avatar_name_list")->setEnabled(god || owner || manager); + getChildView("banned_avatar_name_list")->setEnabled(enable_cotrols); // estate managers can't add estate managers getChildView("add_estate_manager_btn")->setEnabled(god || owner); getChildView("remove_estate_manager_btn")->setEnabled(has_estate_manager && (god || owner)); getChildView("estate_manager_name_list")->setEnabled(god || owner); + + if (enable_cotrols != mCtrlsEnabled) + { + mCtrlsEnabled = enable_cotrols; + updateLists(); // update the lists on the agent's access level change + } } //--------------------------------------------------------------------------- diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index d0b978e38e..5d0f5fc6fc 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -549,6 +549,7 @@ private: void copyListToClipboard(std::string list_name); bool mPendingUpdate; + BOOL mCtrlsEnabled; }; #endif