c1ac48b0feb9a8ff0f0bb16d7aff15d417d6772b
lrnassar
  Tue Sep 8 12:38:42 2026 -0700
Share dialog: scope the snapshot-lifetime wording to the BLAT alignment share only. Feedback from CR. refs #37996

The softer durability text (link valid for years, save into a Session for permanence) keyed
on the generic url mode, so hgTrackUi's page-share link and the hgc item-popup share, both
plain non-expiring URLs, showed misleading copy. The wording is now behind an explicit
snapshot flag that only the BLAT alignment page's share passes; every other caller keeps
"Links never time out". Also removes a stray blank line in hgc.c from the same review.

diff --git src/hg/js/topLinks.js src/hg/js/topLinks.js
index d591c968295..b16377e50a7 100644
--- src/hg/js/topLinks.js
+++ src/hg/js/topLinks.js
@@ -212,36 +212,36 @@
             note.appendChild(el("a", {href: loginEl ? loginEl.getAttribute("href") : "../cgi-bin/hgLogin",
                                       textContent: "Log in"}));
             note.appendChild(document.createTextNode(
                 " to give your links a name and to edit or update them later."));
         }
         body.appendChild(note);
     }
 
     // Show the resulting share URL with a "Copy to clipboard" button.  opts (session mode):
     //   {name: <current session name>, session: true, loggedIn: <bool>}.  A logged-in session link
     //   also gets a "Specify name" button.  url mode passes no opts → just the link + Copy.
     function showResult(body, url, opts) {
         opts = opts || {};
         var canRename = opts.session && opts.loggedIn;
         body.innerHTML = "";
-        // Saved sessions never expire (site policy); a url-mode link (the BLAT alignment page's
-        // snapshot) is durable while used but cleaned after years of no use, so it makes the
-        // softer promise and points at sessions for permanence.
-        var durability = opts.session ? "Links never time out:" :
+        // Saved sessions and plain page URLs never expire; an anonymous snapshot link (the BLAT
+        // alignment page's share, opts.snapshot) is durable while used but cleaned after years of
+        // no use, so only that case makes the softer promise and points at sessions for permanence.
+        var durability = opts.snapshot ?
             "The link remains valid for years; to keep your results permanently, save them " +
-            "into a Session:";
+            "into a Session:" : "Links never time out:";
         body.appendChild(el("p", {textContent: "You can share this link with collaborators, put " +
             "it into figure legends or manuscripts. " + durability}, {marginTop: "0"}));
         // Read-only text region (not an <input>) so it's clear the URL isn't meant to be edited.
         var urlBox = el("div", {id: "tlShareUrl", textContent: url},
                         {background: "#f0f0f0", padding: "6px 8px", borderRadius: "4px",
                          wordBreak: "break-all", userSelect: "all", fontFamily: "monospace"});
         urlBox.setAttribute("data-copy", url);   // copyToClipboard() reads data-copy or innerText
         body.appendChild(urlBox);
 
         var btnRow = el("div", {}, {marginTop: "8px"});
         var copyBtn = el("button", {title: "Copy URL to clipboard"});
         copyBtn.setAttribute("data-target", "tlShareUrl");
         copyBtn.innerHTML = clipboardSvg + "Copy to clipboard";
         copyBtn.addEventListener("click", function(ev) {
             if (typeof copyToClipboard === "function") copyToClipboard(ev);
@@ -324,31 +324,31 @@
                 return url;
             return url + (url.indexOf("?") >= 0 ? "&" : "?") + name + "=" + encodeURIComponent(val);
         }
     }
 
     // Open a simple "here is the link" dialog for an arbitrary URL, with the hgsid stripped.
     // Used by hgTrackUi (the current page) and by the hgc item-details popup in hgTracks.js.
     // opts (optional): {ensureDb: <db> to add db= if missing, pageNote: true to note it's page-only}.
     function shareUrlDialog(url, opts) {
         opts = opts || {};
         var clean = stripHgsid(url);
         if (opts.ensureDb)
             clean = ensureParam(clean, "db", opts.ensureDb);
         var body = document.createElement("div");
         showModal("Share a link", body, 720);
-        showResult(body, clean, {pageNote: opts.pageNote});
+        showResult(body, clean, {pageNote: opts.pageNote, snapshot: opts.snapshot});
     }
 
     function showShareDialog(link) {
         var mode = link.getAttribute("data-sharemode") || "session";
 
         // hgTrackUi etc.: the shareable thing is just this page's URL without the hgsid.  Note
         // that it opens the page, not the user's session/tracks (like the hgc popup link).
         if (mode === "url") {
             shareUrlDialog(window.location.href, {pageNote: true});
             return;
         }
 
         // Session mode (hgTracks): don't create the session yet.  Opening the dialog and closing it
         // should not litter the user's session list with unused links, so we only create the session
         // when the user clicks the button (which then also copies the link in one step).  We still