8c0ef9e7b8633c0994cdaf8030d9c49c8b402016
max
  Sat Sep 26 21:53:54 2026 -0700
cart/hgSession: fix the session-load notice to always name the session actually loaded

diff --git src/hg/lib/cart.c src/hg/lib/cart.c
index e239216bf5c..e5194a87a3f 100644
--- src/hg/lib/cart.c
+++ src/hg/lib/cart.c
@@ -955,34 +955,39 @@
         cartSetString(cart, sessionVar, hgsid);
         if (sessionTableString != NULL)
             cartSetString(cart, hgSessionTableState, sessionTableString);
         if (pubSessionsTableString != NULL)
             cartSetString(cart, hgPublicSessionsTableState, pubSessionsTableString);
         if (oldVars)
             hashEmpty(oldVars);
         /* Overload settings explicitly passed in via CGI (except for the
          * command that sent us here): */
         loadCgiOverHash(cart, oldVars);
         if (isNotEmpty(actionVar))
             cartRemove(cart, actionVar);
         hDisconnectCentral(&conn2);
 
         /* A full (non-merge) load just threw away whatever the user had in the browser before.
-         * Leave a marker so that the next hgTracks page can say what was opened and that the
-         * old view is gone.  A merge keeps the current view, so it needs no note. */
+         * Leave a marker, naming the session actually being loaded here, so that the next
+         * hgTracks page can say what was opened and that the old view is gone.  A merge keeps
+         * the current view, so it needs no note. */
         if (!merge)
+            {
             cartSetString(cart, hgsSessionJustLoaded, "on");
+            cartSetString(cart, hgsOtherUserSessionName, sessionName);
+            cartSetString(cart, hgsOtherUserName, sessionOwner);
+            }
 
         /* When loading another user's session, strip accepted-share cart vars
          * so we don't carry shares from the session owner into the current user's
          * cart. Shares are per-user; they should be re-accepted via share link. */
         char *userName = wikiLinkUserName();
         if (cfgOptionBooleanDefault("doMyVariants", FALSE)
             && (userName == NULL || !sameString(sessionOwner, userName)))
             {
             cartRemoveLike(cart, MYVAR_SHARED_CART_PREFIX "*");
             }
         }
     else
 	errAbort("Sharing has not been enabled for user %s's session %s.",
 		 sessionOwner, sessionName);
     }