5538755f556a081861b4b715ca6cc70fbc49ec7c
jcasper
  Fri Feb 24 16:36:25 2017 -0800
hgSession and PublicSessions should now work when gbMembers is remote, refs #18800

diff --git src/hg/hgPublicSessions/hgPublicSessions.c src/hg/hgPublicSessions/hgPublicSessions.c
index 767d0b8..a151339 100644
--- src/hg/hgPublicSessions/hgPublicSessions.c
+++ src/hg/hgPublicSessions/hgPublicSessions.c
@@ -15,30 +15,31 @@
 #include "hui.h"
 #include "ra.h"
 #include "dystring.h"
 #include "hPrint.h"
 #include "hgConfig.h"
 #include "sessionThumbnail.h"
 #include "jsHelper.h"
 #include "verbose.h"
 
 struct galleryEntry
 /* Holds data for a single session in the gallery*/
     {
     struct galleryEntry *next;
     char *userName;
     char *realName;
+    char *userIdx;
     char *sessionName;
     char *settings;
     char *db;
     char *firstUse;
     char *imgPath;
     char *imgUri;
     struct dyString *sessionUrl;
     unsigned long useCount;
     };
 
 /* Global Variables */
 struct cart *cart;             /* CGI and other variables */
 struct hash *oldVars = NULL;
 
 
@@ -47,37 +48,41 @@
  * 0. gbMembers.realName
  * 1. namedSessionDb.userName
  * 2. gbMembers.idx
  * 3. namedSessionDb.sessionName
  * 4. namedSessionDb.useCount
  * 5. namedSessionDb.settings
  * 6. namedSessionDb.contents
  * 7. namedSessionDb.firstUse */
 {
 char *dbIdx, *dbEnd;
 struct galleryEntry *ret;
 AllocVar(ret);
 ret->realName = cloneString(row[0]);
 ret->userName = cloneString(row[1]);
 cgiDecodeFull(ret->userName, ret->userName, strlen(ret->userName));
+ret->userIdx = cloneString(row[2]);
 ret->sessionName = cloneString(row[3]);
 cgiDecodeFull(ret->sessionName, ret->sessionName, strlen(ret->sessionName));
 ret->sessionUrl = dyStringCreate("hgS_doOtherUser=submit&hgS_otherUserName=%s&hgS_otherUserSessionName=%s", row[1], row[3]);
 
-ret->imgPath = sessionThumbnailFilePath(row[2], row[3], row[7]);
+char *userIdentifier = sessionThumbnailGetUserIdentifier(row[1], ret->userIdx);
+
+fprintf(stderr, "User %s, id %s, ident %s\n", row[1], row[2], userIdentifier);
+ret->imgPath = sessionThumbnailFilePath(userIdentifier, row[3], row[7]);
 if (fileExists(ret->imgPath))
-    ret->imgUri = sessionThumbnailFileUri(row[2], row[3], row[7]);
+    ret->imgUri = sessionThumbnailFileUri(userIdentifier, row[3], row[7]);
 else
     ret->imgUri = NULL;
 ret->useCount = sqlUnsignedLong(row[4]);
 ret->settings = cloneString(row[5]);
 if (startsWith("db=", row[6]))
     dbIdx = row[6] + 3;
 else
     dbIdx = strstr(row[6], "&db=") + 4;
 if (dbIdx != NULL)
     {
     dbEnd = strchr(dbIdx, '&');
     if (dbEnd != NULL)
         ret->db = cloneStringZ(dbIdx, dbEnd-dbIdx);
     else
         ret->db = cloneString(dbIdx);