From d9cf4691a7369004a1ceeb11ca8d3262648c05e7 Mon Sep 17 00:00:00 2001
From: Paul ProductEngine <pguslisty@productengine.com>
Date: Fri, 18 May 2012 21:01:10 +0300
Subject: [PATCH] MAINT-938 ADDITIONAL FIX (Make debit-permissions dialog give
 a stronger warning)

- Requested permissions are added dynamically to the dialog's footer
- And the footer is not shown when it is empty
---
 indra/llui/llnotifications.cpp                       |  5 +++--
 indra/newview/llviewermessage.cpp                    | 11 ++++++++++-
 indra/newview/skins/default/xui/en/notifications.xml |  4 +---
 indra/newview/skins/default/xui/en/strings.xml       |  1 +
 4 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 1dc657f9156..09480968a67 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -876,8 +876,9 @@ std::string LLNotification::getFooter() const
 	if (!mTemplatep)
 		return std::string();
 
-	std::string message = mTemplatep->mFooter;
-	return message;
+	std::string footer = mTemplatep->mFooter;
+	LLStringUtil::format(footer, mSubstitutions);
+	return footer;
 }
 
 std::string LLNotification::getLabel() const
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 2917fee62e9..7d6370676e0 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -5972,16 +5972,21 @@ void process_script_question(LLMessageSystem *msg, void **user_data)
 		args["OBJECTNAME"] = object_name;
 		args["NAME"] = LLCacheName::cleanFullName(owner_name);
 
+		BOOL has_not_only_debit = questions ^ LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_DEBIT];
 		// check the received permission flags against each permission
 		for (S32 i = 0; i < SCRIPT_PERMISSION_EOF; i++)
 		{
 			if (questions & LSCRIPTRunTimePermissionBits[i])
 			{
 				count++;
-				script_question += "    " + LLTrans::getString(SCRIPT_QUESTIONS[i]) + "\n";
 
 				// check whether permission question should cause special caution dialog
 				caution |= (SCRIPT_QUESTION_IS_CAUTION[i]);
+
+				if (("ScriptTakeMoney" ==  SCRIPT_QUESTIONS[i]) && has_not_only_debit)
+					continue;
+
+				script_question += "    " + LLTrans::getString(SCRIPT_QUESTIONS[i]) + "\n";
 			}
 		}
 		args["QUESTIONS"] = script_question;
@@ -5997,6 +6002,10 @@ void process_script_question(LLMessageSystem *msg, void **user_data)
 		// check whether cautions are even enabled or not
 		if (gSavedSettings.getBOOL("PermissionsCautionEnabled"))
 		{
+			if (caution)
+			{
+				args["FOOTERTEXT"] = (count > 1) ? LLTrans::getString("AdditionalPermissionsRequestHeader") + "\n\n" + script_question : "";
+			}
 			// display the caution permissions prompt
 			LLNotificationsUtil::add(caution ? "ScriptQuestionCaution" : "ScriptQuestion", args, payload);
 		}
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 4e0f52b8fe2..351e33c17cb 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -6393,9 +6393,7 @@ It is rare that such a request is legitimate. Do not allow access if you do not
        text="Deny"/>
     </form>
     <footer>
-If you allow access to your account, you will also be allowing the object to:
-Animate your avatar
-Act on your control inputs
+[FOOTERTEXT]
     </footer>
   </notification>
 
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 97526526794..9e8aa115833 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -393,6 +393,7 @@ Please try logging in again in a minute.</string>
   <string name="reconnect_nearby">You will now be reconnected to Nearby Voice Chat</string>
 	<string name="ScriptQuestionCautionChatGranted">'[OBJECTNAME]', an object owned by '[OWNERNAME]', located in [REGIONNAME] at [REGIONPOS], has been granted permission to: [PERMISSIONS].</string>
 	<string name="ScriptQuestionCautionChatDenied">'[OBJECTNAME]', an object owned by '[OWNERNAME]', located in [REGIONNAME] at [REGIONPOS], has been denied permission to: [PERMISSIONS].</string>
+	<string name="AdditionalPermissionsRequestHeader">If you allow access to your account, you will also be allowing the object to:</string>
 	<string name="ScriptTakeMoney">Take Linden dollars (L$) from you</string>
 	<string name="ActOnControlInputs">Act on your control inputs</string>
 	<string name="RemapControlInputs">Remap your control inputs</string>
-- 
GitLab