From 1ea68249d88a603d294628cf966f0e9317425aa1 Mon Sep 17 00:00:00 2001
From: AndreyL ProductEngine <alihatskiy@productengine.com>
Date: Wed, 25 Jul 2018 00:02:44 +0300
Subject: [PATCH] MAINT-8583 Fix for the truncated message when removing a
 large number of banned users

---
 indra/newview/llfloaterregioninfo.cpp         | 42 ++++++++++++-------
 .../newview/skins/default/xui/en/strings.xml  |  1 +
 2 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 38fa3bd1534..25f1fb8c139 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -103,6 +103,8 @@
 const S32 TERRAIN_TEXTURE_COUNT = 4;
 const S32 CORNER_COUNT = 4;
 
+const U32 MAX_LISTED_NAMES = 100;
+
 #define TMP_DISABLE_WLES // STORM-1180
 
 ///----------------------------------------------------------------------------
@@ -3828,12 +3830,11 @@ bool LLPanelEstateAccess::accessCoreConfirm(const LLSD& notification, const LLSD
 	}
 
 	std::string names;
-	bool single = true;
-
+	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++)
+		 iter != end_it;
+		 iter++)
 	{
 		if (iter + 1 != end_it)
 		{
@@ -3851,28 +3852,32 @@ bool LLPanelEstateAccess::accessCoreConfirm(const LLSD& notification, const LLSD
 			LLNotificationsUtil::add("OwnerCanNotBeDenied");
 			break;
 		}
-		
+
 		sendEstateAccessDelta(flags, id);
 
 		if ((flags & (ESTATE_ACCESS_ALLOWED_GROUP_ADD | ESTATE_ACCESS_ALLOWED_GROUP_REMOVE)) == 0)
 		{
 			// fill the name list for confirmation
-			LLAvatarName av_name;
-			if (LLAvatarNameCache::get(id, &av_name))
+			if (listed_names < MAX_LISTED_NAMES)
 			{
-				if (!names.empty())
+				LLAvatarName av_name;
+				if (LLAvatarNameCache::get(id, &av_name))
 				{
-					names += ", ";
-					single = false;
-				}
-				names += av_name.getCompleteName();
+					if (!names.empty())
+					{
+						names += ", ";
+					}
+					names += av_name.getCompleteName();
+				}				
 			}
+			listed_names++;
 		}
 	}
-	LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
-	if (panel)
+	if (listed_names > MAX_LISTED_NAMES)
 	{
-		panel->setPendingUpdate(true);
+		LLSD args;
+		args["EXTRA_COUNT"] = llformat("%d", listed_names - MAX_LISTED_NAMES);
+		names += " " + LLTrans::getString("AndNMore", args);
 	}
 
 	if (!names.empty()) // show the conirmation
@@ -3902,6 +3907,7 @@ bool LLPanelEstateAccess::accessCoreConfirm(const LLSD& notification, const LLSD
 			args["ESTATE"] = LLTrans::getString("RegionInfoThisEstate");
 		}
 
+		bool single = (listed_names == 1);
 		if (flags & (ESTATE_ACCESS_ALLOWED_AGENT_ADD | ESTATE_ACCESS_BANNED_AGENT_ADD))
 		{
 			LLNotificationsUtil::add(single ? "AgentWasAddedToList" : "AgentsWereAddedToList", args);
@@ -3912,6 +3918,12 @@ bool LLPanelEstateAccess::accessCoreConfirm(const LLSD& notification, const LLSD
 		}		
 	}
 
+	LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
+	if (panel)
+	{
+		panel->setPendingUpdate(true);
+	}
+
 	return false;
 }
 
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index fd2749bb81a..d4327b0c7cc 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -2661,6 +2661,7 @@ If you continue to receive this message, please contact Second Life support for
 	<string name="RegionInfoAllEstates">all estates</string>
 	<string name="RegionInfoManagedEstates">managed estates</string>
 	<string name="RegionInfoThisEstate">this estate</string>
+	<string name="AndNMore">and [EXTRA_COUNT] more</string>
 
 	<!-- script limits floater -->
 	<string name="ScriptLimitsParcelScriptMemory">Parcel Script Memory</string>
-- 
GitLab