From 189329853b8d50da53f34dfa1cf42f49cc02df77 Mon Sep 17 00:00:00 2001
From: Vadim Savchuk <vsavchuk@productengine.com>
Date: Fri, 22 Jan 2010 20:08:09 +0200
Subject: [PATCH] Fixed bug EXT-4582 ([BSI] "Report" from avatar inspector does
 not auto-populate "Abuser name" when Resident is not nearby). Added method
 LLFloaterReporter::showFromAvatar() to use for remote avatars.

--HG--
branch : product-engine
---
 indra/newview/llfloaterreporter.cpp | 43 +++++++++++++++++++++--------
 indra/newview/llfloaterreporter.h   |  4 +++
 indra/newview/llinspectavatar.cpp   |  2 +-
 3 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index e0f2fca5809..2efae0c8dbf 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -277,13 +277,8 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id)
 				{
 					object_owner.append("Unknown");
 				}
-				childSetText("object_name", object_owner);
-				std::string owner_link =
-					LLSLURL::buildCommand("agent", mObjectID, "inspect");
-				childSetText("owner_name", owner_link);
-				childSetText("abuser_name_edit", object_owner);
-				mAbuserID = object_id;
-				mOwnerName = object_owner;
+
+				setFromAvatar(object_id, object_owner);
 			}
 			else
 			{
@@ -305,7 +300,6 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id)
 	}
 }
 
-
 void LLFloaterReporter::onClickSelectAbuser()
 {
 	gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), FALSE, TRUE ));
@@ -323,6 +317,17 @@ void LLFloaterReporter::callbackAvatarID(const std::vector<std::string>& names,
 
 }
 
+void LLFloaterReporter::setFromAvatar(const LLUUID& avatar_id, const std::string& avatar_name)
+{
+	mAbuserID = mObjectID = avatar_id;
+	mOwnerName = avatar_name;
+
+	std::string avatar_link = LLSLURL::buildCommand("agent", mObjectID, "inspect");
+	childSetText("owner_name", avatar_link);
+	childSetText("object_name", avatar_name); // name
+	childSetText("abuser_name_edit", avatar_name);
+}
+
 // static
 void LLFloaterReporter::onClickSend(void *userdata)
 {
@@ -458,9 +463,8 @@ void LLFloaterReporter::showFromMenu(EReportType report_type)
 	}
 }
 
-
 // static
-void LLFloaterReporter::showFromObject(const LLUUID& object_id)
+void LLFloaterReporter::show(const LLUUID& object_id, const std::string& avatar_name)
 {
 	LLFloaterReporter* f = LLFloaterReg::showTypedInstance<LLFloaterReporter>("reporter");
 
@@ -469,8 +473,11 @@ void LLFloaterReporter::showFromObject(const LLUUID& object_id)
 	LLAgentUI::buildFullname(fullname);
 	f->childSetText("reporter_field", fullname);
 
-	// Request info for this object
-	f->getObjectInfo(object_id);
+	if (avatar_name.empty())
+		// Request info for this object
+		f->getObjectInfo(object_id);
+	else
+		f->setFromAvatar(object_id, avatar_name);
 
 	// Need to deselect on close
 	f->mDeselectOnClose = TRUE;
@@ -479,6 +486,18 @@ void LLFloaterReporter::showFromObject(const LLUUID& object_id)
 }
 
 
+// static
+void LLFloaterReporter::showFromObject(const LLUUID& object_id)
+{
+	show(object_id);
+}
+
+// static
+void LLFloaterReporter::showFromAvatar(const LLUUID& avatar_id, const std::string avatar_name)
+{
+	show(avatar_id, avatar_name);
+}
+
 void LLFloaterReporter::setPickedObjectProperties(const std::string& object_name, const std::string& owner_name, const LLUUID owner_id)
 {
 	childSetText("object_name", object_name);
diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h
index cc2dfb2f981..7c6473f9759 100644
--- a/indra/newview/llfloaterreporter.h
+++ b/indra/newview/llfloaterreporter.h
@@ -93,6 +93,7 @@ class LLFloaterReporter
 	static void showFromMenu(EReportType report_type);
 
 	static void showFromObject(const LLUUID& object_id);
+	static void showFromAvatar(const LLUUID& avatar_id, const std::string avatar_name);
 
 	static void onClickSend			(void *userdata);
 	static void onClickCancel		(void *userdata);
@@ -109,6 +110,8 @@ class LLFloaterReporter
 	void setPickedObjectProperties(const std::string& object_name, const std::string& owner_name, const LLUUID owner_id);
 
 private:
+	static void show(const LLUUID& object_id, const std::string& avatar_name = LLStringUtil::null);
+
 	void takeScreenshot();
 	void sendReportViaCaps(std::string url);
 	void uploadImage();
@@ -121,6 +124,7 @@ class LLFloaterReporter
 	void enableControls(BOOL own_avatar);
 	void getObjectInfo(const LLUUID& object_id);
 	void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
+	void setFromAvatar(const LLUUID& avatar_id, const std::string& avatar_name = LLStringUtil::null);
 
 private:
 	EReportType		mReportType;
diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index 0374a1d25b0..4b0539337ba 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -689,7 +689,7 @@ void LLInspectAvatar::onToggleMute()
 
 void LLInspectAvatar::onClickReport()
 {
-	LLFloaterReporter::showFromObject(mAvatarID);
+	LLFloaterReporter::showFromAvatar(mAvatarID, mAvatarName);
 	closeFloater();
 }
 
-- 
GitLab