From b4e54352171f6b95714270909cda99dc1c5ad3f0 Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Wed, 24 May 2017 11:06:21 +0300
Subject: [PATCH] MAINT-7434 FIXED SLURL instead of username appears in "have
 said something new" text for some messages

---
 indra/newview/llnotificationhandler.h       |  2 ++
 indra/newview/llnotificationhandlerutil.cpp | 14 ++++++++++++++
 indra/newview/llnotificationtiphandler.cpp  |  2 +-
 indra/newview/llviewermessage.cpp           |  1 +
 4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h
index 7a183cb298..52c5234137 100644
--- a/indra/newview/llnotificationhandler.h
+++ b/indra/newview/llnotificationhandler.h
@@ -322,6 +322,8 @@ public:
 	 */
 	static std::string getSubstitutionName(const LLNotificationPtr& notification);
 
+	static std::string getSubstitutionOriginalName(const LLNotificationPtr& notification);
+
 	/**
 	 * Adds notification panel to the IM floater.
 	 */
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index 4a3923ef6e..6a58196760 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -241,6 +241,20 @@ std::string LLHandlerUtil::getSubstitutionName(const LLNotificationPtr& notifica
 	return res;
 }
 
+// static
+std::string LLHandlerUtil::getSubstitutionOriginalName(const LLNotificationPtr& notification)
+{
+	if(notification->getSubstitutions().has("ORIGINAL_NAME"))
+	{
+		std::string name = notification->getSubstitutions()["ORIGINAL_NAME"];
+		if(!name.empty())
+		{
+			return name;
+		}
+	}
+	return LLHandlerUtil::getSubstitutionName(notification);
+}
+
 // static
 void LLHandlerUtil::addNotifPanelToIM(const LLNotificationPtr& notification)
 {
diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp
index 596327e8f1..a6ef130cd0 100644
--- a/indra/newview/llnotificationtiphandler.cpp
+++ b/indra/newview/llnotificationtiphandler.cpp
@@ -86,7 +86,7 @@ bool LLTipHandler::processNotification(const LLNotificationPtr& notification)
 	}
 
 	std::string session_name = notification->getPayload()["SESSION_NAME"];
-	const std::string name = notification->getSubstitutions()["NAME"];
+	const std::string name = LLHandlerUtil::getSubstitutionOriginalName(notification);
 	if (session_name.empty())
 	{
 		session_name = name;
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 2dc219a769..06f868dc08 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -2841,6 +2841,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 	case IM_INVENTORY_ACCEPTED:
 	{
 		args["NAME"] = LLSLURL("agent", from_id, "completename").getSLURLString();;
+		args["ORIGINAL_NAME"] = original_name;
 		LLSD payload;
 		payload["from_id"] = from_id;
 		// Passing the "SESSION_NAME" to use it for IM notification logging
-- 
GitLab