373b5c4187422a9584814dcfa324028fd2e50f14
chmalee
  Tue Aug 4 15:00:30 2026 -0700
Have the pre-finish hook return the rows it wrote, and fix the table display bugs that the real row data now lets us resolve, refs #37999

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

diff --git src/hg/inc/userdata.h src/hg/inc/userdata.h
index 3f3d8881194..31d26898351 100644
--- src/hg/inc/userdata.h
+++ src/hg/inc/userdata.h
@@ -1,24 +1,25 @@
 /* userdata.c - code for managing data stored on a per user basis */
 
 /* Copyright (C) 2014 The Regents of the University of California 
  * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */
 
 #ifndef USERDATA_H
 #define USERDATA_H
 
 #include "hubSpace.h"
+#include "jsonWrite.h"
 
 // 2bit genome-name collision error. Shared with the JS client so it
 // can identify this error from the message.
 #define HUB_GENOME_COLLISION_ERR_FRAG \
     "matches an existing UCSC native assembly or GenArk hub"
 
 #define HUB_GENOME_COLLISION_ERR_FMT \
     "Genome name '%s' " HUB_GENOME_COLLISION_ERR_FRAG ". " \
     "The Genome Browser will load the UCSC assembly instead of your 2bit. " \
     "Edit the Genome field and try a different name (e.g. '%s_hub')."
 
 struct userFiles
 {
 char *userName;
 struct fileInfo *fileList; // list of files for this user
@@ -121,25 +122,32 @@
 /* Release an exclusive hub lock acquired by lockHubDir. */
 
 void addHubSpaceRowForFile(struct hubSpace *row);
 /* We created a file for a user, now add an entry to the hubSpace table for it */
 
 void makeParentDirRows(char *userName, time_t lastModified, char *db, char *parentDirStr, char *userDataDir, char *hubType);
 /* For each '/' separated component of parentDirStr, create a row in hubSpace. Return the
  * final subdirectory component of parentDirStr */
 
 void removeFileForUser(char *fname, char *userName);
 /* Remove a file for this user if it exists */
 
 struct hubSpace *listFilesForUser(char *userName);
 /* Return the files the user has uploaded */
 
+struct hubSpace *listFilesInHubDir(char *userName, char *hubName);
+/* Return the user's rows for one hub: the hub's own directory row plus every row
+ * underneath it */
+
+void hubSpaceWriteFileList(struct jsonWrite *jw, char *userName, struct hubSpace *fileList);
+/* Write fileList as the "fileList" array of jw, in the row shape the My Data table reads */
+
 char *defaultHubNameForUser(char *userName);
 /* Return a name to use as a default for a hub, starts with myFirstHub, then myFirstHub2, ... */
 
 long long getMaxUserQuota(char *userName);
 /* Return how much space is allocated for this user or the default */
 
 long long checkUserQuota(char *userName);
 /* Return the amount of space a user is currently using */
 
 #endif /* USERDATA_H */