From 91eaefd37d4147657dd7765bd84d8d8b16b57492 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Wed, 30 Dec 2020 20:12:08 -0500
Subject: [PATCH] Add report abuse option to chat menus

---
 indra/newview/llchathistory.cpp                        |  9 ++++++---
 indra/newview/llconversationmodel.cpp                  |  1 +
 indra/newview/llfloaterimcontainer.cpp                 |  4 ++++
 .../newview/skins/default/xui/en/menu_avatar_icon.xml  |  6 ++++++
 .../newview/skins/default/xui/en/menu_conversation.xml |  6 ++++++
 .../skins/default/xui/en/menu_im_conversation.xml      | 10 ++++++++--
 6 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index f4a8ac80dd4..28f783f8758 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -435,6 +435,10 @@ class LLChatHistoryHeader: public LLPanel
 		{
 			LLAvatarActions::toggleMute(getAvatarId(), LLMute::flagTextChat);
 		}
+		else if (level == "report_abuse")
+		{
+			ALAvatarActions::reportAbuse(getAvatarId());
+		}
 		else if(level == "toggle_allow_text_chat")
 		{
 			LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
@@ -918,6 +922,7 @@ class LLChatHistoryHeader: public LLPanel
 				menu->setItemEnabled("Pay", false);
 				menu->setItemEnabled("Block Unblock", false);
 				menu->setItemEnabled("Mute Text", false);
+				menu->setItemEnabled("Report", false);
 			}
 			else
 			{
@@ -930,9 +935,7 @@ class LLChatHistoryHeader: public LLPanel
 				menu->setItemEnabled("Request Teleport", LLAvatarActions::canOfferTeleport(mAvatarID));
 				menu->setItemEnabled("Voice Call", LLAvatarActions::canCall());
 
-				// We should only show 'Zoom in' item in a nearby chat
-				bool should_show_zoom = !LLIMModel::getInstance()->findIMSession(currentSessionID);
-				menu->setItemVisible("Zoom In", should_show_zoom && gObjectList.findObject(mAvatarID));	
+				menu->setItemVisible("Zoom In", ALAvatarActions::canZoomIn(mAvatarID));	
 				menu->setItemEnabled("Block Unblock", LLAvatarActions::canBlock(mAvatarID));
 				menu->setItemEnabled("Mute Text", LLAvatarActions::canBlock(mAvatarID));
 				menu->setItemEnabled("Chat History", LLLogChat::isTranscriptExist(mAvatarID));
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp
index 5ca02388f8d..b7927ea05b6 100644
--- a/indra/newview/llconversationmodel.cpp
+++ b/indra/newview/llconversationmodel.cpp
@@ -184,6 +184,7 @@ void LLConversationItem::buildParticipantMenuOptions(menuentry_vec_t& items, U32
 		items.push_back(std::string("pay"));
 		items.push_back(std::string("block_unblock"));
 		items.push_back(std::string("MuteText"));
+		items.push_back(std::string("report_abuse"));
 
 		if ((getType() != CONV_SESSION_1_ON_1) && mDisplayModeratorOptions)
 		{
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index 9b5f202ca6a..b6ffb884d37 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -1195,6 +1195,10 @@ void LLFloaterIMContainer::doToParticipants(const std::string& command, uuid_vec
 		{
 			LLAvatarActions::toggleMute(userID, LLMute::flagVoiceChat);
 		}
+		else if ("report_abuse" == command)
+		{
+			ALAvatarActions::reportAbuse(userID);
+		}
 		else if ("mute_unmute" == command)
 		{
 			LLAvatarActions::toggleMute(userID, LLMute::flagTextChat);
diff --git a/indra/newview/skins/default/xui/en/menu_avatar_icon.xml b/indra/newview/skins/default/xui/en/menu_avatar_icon.xml
index 70bf4ea77c5..55ec42bbf7c 100644
--- a/indra/newview/skins/default/xui/en/menu_avatar_icon.xml
+++ b/indra/newview/skins/default/xui/en/menu_avatar_icon.xml
@@ -111,6 +111,12 @@
        <on_click function="AvatarIcon.Action" parameter="mute_unmute" />
        <on_check function="AvatarIcon.Check" parameter="is_muted" />   
     </menu_item_check>
+    <menu_item_call
+     label="Report"
+     layout="topleft"
+     name="Report">
+       <on_click function="AvatarIcon.Action" parameter="report_abuse" />
+    </menu_item_call>
     <menu_item_separator layout="topleft" name="Moderator Options Separator"/>
     <context_menu
      label="Moderator Options"
diff --git a/indra/newview/skins/default/xui/en/menu_conversation.xml b/indra/newview/skins/default/xui/en/menu_conversation.xml
index cbf15c22b40..3d10e3fab95 100644
--- a/indra/newview/skins/default/xui/en/menu_conversation.xml
+++ b/indra/newview/skins/default/xui/en/menu_conversation.xml
@@ -148,6 +148,12 @@
      <on_check function="Avatar.CheckItem" parameter="is_muted" />
      <on_enable  function="Avatar.EnableItem" parameter="can_block" />
     </menu_item_check>
+    <menu_item_call
+     label="Report"
+     layout="topleft"
+     name="report_abuse">
+        <on_click function="Avatar.DoToSelected" parameter="report_abuse" />
+    </menu_item_call>
     <menu_item_call
      label="Group Profile"
      layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/menu_im_conversation.xml b/indra/newview/skins/default/xui/en/menu_im_conversation.xml
index a8d810eb8a6..b793dcce83f 100644
--- a/indra/newview/skins/default/xui/en/menu_im_conversation.xml
+++ b/indra/newview/skins/default/xui/en/menu_im_conversation.xml
@@ -53,8 +53,8 @@
        label="Zoom In"
        layout="topleft"
        name="zoom_in">
-      <on_click function="Avatar.DoToSelected" parameter="zoom_in" />
-      <on_enable function="Avatar.EnableItem" parameter="can_zoom_in" />
+      <on_click function="Avatar.GearDoToSelected" parameter="zoom_in" />
+      <on_enable function="Avatar.EnableGearItem" parameter="can_zoom_in" />
     </menu_item_call>
     <menu_item_call
      label="Map"
@@ -95,6 +95,12 @@
         <on_click function="Avatar.GearDoToSelected" parameter="mute_unmute" />
         <on_enable function="Avatar.EnableGearItem" parameter="can_block" />
     </menu_item_check>
+    <menu_item_call
+     label="Report"
+     layout="topleft"
+     name="report_abuse">
+        <on_click function="Avatar.GearDoToSelected" parameter="report_abuse" />
+    </menu_item_call>
   <menu_item_separator name="separator_utils"/>
   <context_menu
    label="Utilities"
-- 
GitLab