From a6daa3a26d2b566df0a0563fc6d6c40fb385a1f0 Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Fri, 31 Mar 2023 17:47:07 +0300
Subject: [PATCH] SL-19432 External group links dont load in SL

---
 indra/newview/llagentlistener.cpp             | 4 ++--
 indra/newview/llcommanddispatcherlistener.cpp | 9 +++++++--
 indra/newview/llcommandhandler.cpp            | 2 ++
 indra/newview/llcommandhandler.h              | 2 ++
 indra/newview/llgroupactions.cpp              | 2 +-
 indra/newview/llstartup.cpp                   | 2 +-
 indra/newview/llurldispatcher.cpp             | 4 ++--
 indra/newview/llviewerregion.cpp              | 2 +-
 indra/newview/llviewerwindow.cpp              | 5 +++--
 indra/newview/llworldmapview.cpp              | 2 +-
 10 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp
index 7887184a11b..b7f5aeb8e05 100644
--- a/indra/newview/llagentlistener.cpp
+++ b/indra/newview/llagentlistener.cpp
@@ -148,7 +148,7 @@ void LLAgentListener::requestTeleport(LLSD const & event_data) const
         params.append(event_data["x"]);
         params.append(event_data["y"]);
         params.append(event_data["z"]);
-        LLCommandDispatcher::dispatch("teleport", params, LLSD(), NULL, "clicked", true);
+        LLCommandDispatcher::dispatch("teleport", params, LLSD(), NULL, LLCommandHandler::NAV_TYPE_CLICKED, true);
         // *TODO - lookup other LLCommandHandlers for "agent", "classified", "event", "group", "floater", "parcel", "login", login_refresh", "balance", "chat"
         // should we just compose LLCommandHandler and LLDispatchListener?
     }
@@ -158,7 +158,7 @@ void LLAgentListener::requestTeleport(LLSD const & event_data) const
                                   LLVector3(event_data["x"].asReal(), 
                                             event_data["y"].asReal(), 
                                             event_data["z"].asReal())).getSLURLString();
-        LLURLDispatcher::dispatch(url, "clicked", NULL, false);
+        LLURLDispatcher::dispatch(url, LLCommandHandler::NAV_TYPE_CLICKED, NULL, false);
     }
 }
 
diff --git a/indra/newview/llcommanddispatcherlistener.cpp b/indra/newview/llcommanddispatcherlistener.cpp
index 586f45fd8f4..518f5bc374a 100644
--- a/indra/newview/llcommanddispatcherlistener.cpp
+++ b/indra/newview/llcommanddispatcherlistener.cpp
@@ -64,8 +64,13 @@ void LLCommandDispatcherListener::dispatch(const LLSD& params) const
         // But for testing, allow a caller to specify untrusted.
         trusted_browser = params["trusted"].asBoolean();
     }
-    LLCommandDispatcher::dispatch(params["cmd"], params["params"], params["query"], NULL,
-                                  "clicked", trusted_browser);
+    LLCommandDispatcher::dispatch(
+        params["cmd"],
+        params["params"],
+        params["query"],
+        NULL,
+        LLCommandHandler::NAV_TYPE_CLICKED,
+        trusted_browser);
 }
 
 void LLCommandDispatcherListener::enumerate(const LLSD& params) const
diff --git a/indra/newview/llcommandhandler.cpp b/indra/newview/llcommandhandler.cpp
index 74f37961c74..9640b05b065 100644
--- a/indra/newview/llcommandhandler.cpp
+++ b/indra/newview/llcommandhandler.cpp
@@ -40,6 +40,8 @@
 
 static LLCommandDispatcherListener sCommandDispatcherListener;
 const std::string LLCommandHandler::NAV_TYPE_CLICKED = "clicked";
+const std::string LLCommandHandler::NAV_TYPE_EXTERNAL = "external";
+const std::string LLCommandHandler::NAV_TYPE_NAVIGATED = "navigated";
 
 //---------------------------------------------------------------------------
 // Underlying registry for command handlers, not directly accessible.
diff --git a/indra/newview/llcommandhandler.h b/indra/newview/llcommandhandler.h
index 763e3ee51f3..486feecca61 100644
--- a/indra/newview/llcommandhandler.h
+++ b/indra/newview/llcommandhandler.h
@@ -70,6 +70,8 @@ class LLCommandHandler
 	};
 
     static const std::string NAV_TYPE_CLICKED;
+    static const std::string NAV_TYPE_EXTERNAL;
+    static const std::string NAV_TYPE_NAVIGATED;
 
 	LLCommandHandler(const char* command, EUntrustedAccess untrusted_access);
 		// Automatically registers object to get called when 
diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp
index be52e280e19..aec6c23e34e 100644
--- a/indra/newview/llgroupactions.cpp
+++ b/indra/newview/llgroupactions.cpp
@@ -52,7 +52,7 @@ class LLGroupHandler : public LLCommandHandler
 {
 public:
 	// requires trusted browser to trigger
-	LLGroupHandler() : LLCommandHandler("group", UNTRUSTED_CLICK_ONLY) { }
+	LLGroupHandler() : LLCommandHandler("group", UNTRUSTED_THROTTLE) { }
 
     virtual bool canHandleUntrusted(
         const LLSD& params,
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 765aca039d5..628ee5d97ce 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -3018,7 +3018,7 @@ bool LLStartUp::dispatchURL()
 			|| (dx*dx > SLOP*SLOP)
 			|| (dy*dy > SLOP*SLOP) )
 		{
-			LLURLDispatcher::dispatch(getStartSLURL().getSLURLString(), "clicked",
+			LLURLDispatcher::dispatch(getStartSLURL().getSLURLString(), LLCommandHandler::NAV_TYPE_CLICKED,
 						  NULL, false);
 		}
 		return true;
diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp
index 7c92e7ef98a..0da769999b0 100644
--- a/indra/newview/llurldispatcher.cpp
+++ b/indra/newview/llurldispatcher.cpp
@@ -142,7 +142,7 @@ bool LLURLDispatcherImpl::dispatchRightClick(const LLSLURL& slurl)
 	const bool right_click = true;
 	LLMediaCtrl* web = NULL;
 	const bool trusted_browser = false;
-	return dispatchCore(slurl, "clicked", right_click, web, trusted_browser);
+    return dispatchCore(slurl, LLCommandHandler::NAV_TYPE_CLICKED, right_click, web, trusted_browser);
 }
 
 // static
@@ -397,7 +397,7 @@ bool LLURLDispatcher::dispatchFromTextEditor(const std::string& slurl, bool trus
 	// *TODO: Make this trust model more refined.  JC
 
 	LLMediaCtrl* web = NULL;
-	return LLURLDispatcherImpl::dispatch(LLSLURL(slurl), "clicked", web, trusted_content);
+    return LLURLDispatcherImpl::dispatch(LLSLURL(slurl), LLCommandHandler::NAV_TYPE_CLICKED, web, trusted_content);
 }
 
 
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index ad7321ca4be..b582e38c781 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -160,7 +160,7 @@ class LLRegionHandler : public LLCommandHandler
         }
 
         // Process the SLapp as if it was a secondlife://{PLACE} SLurl
-        LLURLDispatcher::dispatch(url, "clicked", web, true);
+        LLURLDispatcher::dispatch(url, LLCommandHandler::NAV_TYPE_CLICKED, web, true);
         return true;
     }
        
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index ddc11ac0bd0..b9fcc253102 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -39,6 +39,7 @@
 
 #include "llagent.h"
 #include "llagentcamera.h"
+#include "llcommandhandler.h"
 #include "llcommunicationchannel.h"
 #include "llfloaterreg.h"
 #include "llhudicon.h"
@@ -1296,7 +1297,7 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
 					{
 						if (drop)
 						{
-							LLURLDispatcher::dispatch( dropped_slurl.getSLURLString(), "clicked", NULL, true );
+							LLURLDispatcher::dispatch( dropped_slurl.getSLURLString(), LLCommandHandler::NAV_TYPE_CLICKED, NULL, true );
 							return LLWindowCallbacks::DND_MOVE;
 						}
 						return LLWindowCallbacks::DND_COPY;
@@ -1765,7 +1766,7 @@ void LLViewerWindow::handleDataCopy(LLWindow *window, S32 data_type, void *data)
 		LLMediaCtrl* web = NULL;
 		const bool trusted_browser = false;
 		// don't treat slapps coming from external browsers as "clicks" as this would bypass throttling
-		if (LLURLDispatcher::dispatch(url, "", web, trusted_browser))
+		if (LLURLDispatcher::dispatch(url, LLCommandHandler::NAV_TYPE_EXTERNAL, web, trusted_browser))
 		{
 			// bring window to foreground, as it has just been "launched" from a URL
 			mWindow->bringToFront();
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index 6e994b4e68a..8f46e66551c 100755
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -1829,7 +1829,7 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask )
 				// Invoke the event details floater if someone is clicking on an event.
 				LLSD params(LLSD::emptyArray());
 				params.append(event_id);
-				LLCommandDispatcher::dispatch("event", params, LLSD(), NULL, "clicked", true);
+				LLCommandDispatcher::dispatch("event", params, LLSD(), NULL, LLCommandHandler::NAV_TYPE_CLICKED, true);
 				break;
 			}
 		case MAP_ITEM_LAND_FOR_SALE:
-- 
GitLab