On click of 'My Favorites' link under 'Documents' in the left panel of 'Document Library' page, all the links appear grayed out

This commit is contained in:
Debjit Chattopadhyay
2025-08-27 18:46:24 +05:30
parent bb2cc1765d
commit f17b309c27
2 changed files with 48 additions and 4 deletions

View File

@@ -91,6 +91,15 @@ function doclist_getAllNodes(parsedArgs, filterParams, query, totalItemCount)
}; };
} }
function sanitizeJunkFavouriteKeys(favourites){
for (var key in favourites) {
if (!key || key.trim() === "") {
delete favourites[key];
}
}
return favourites;
}
/** /**
* Main entry point: Create collection of documents and folders in the given space * Main entry point: Create collection of documents and folders in the given space
* *
@@ -124,6 +133,32 @@ function doclist_main()
if (logger.isLoggingEnabled()) if (logger.isLoggingEnabled())
logger.log("doclist.lib.js - NodeRef: " + parsedArgs.nodeRef + " Query: " + query); logger.log("doclist.lib.js - NodeRef: " + parsedArgs.nodeRef + " Query: " + query);
favourites = sanitizeJunkFavouriteKeys(favourites);
logger.warn("Favourites : - " + jsonUtils.toJSONString(favourites));
if(Object.keys(favourites).length === 0 && query === null)
{
logger.warn("doclist.lib.js - Skipping search, no valid query for filter : " + filter);
return {
luceneQuery: "",
paging: {
totalRecords: 0,
startIndex: 0
},
container: parsedArgs.rootNode,
parent: null,
onlineEditing: utils.moduleInstalled("org.alfresco.module.vti"),
itemCount: {
folders: 0,
documents: 0
},
items: [],
customJSON: slingshotDocLib.getJSON()
};
}
var totalItemCount = filterParams.limitResults ? parseInt(filterParams.limitResults, 10) : -1; var totalItemCount = filterParams.limitResults ? parseInt(filterParams.limitResults, 10) : -1;
// For all sites documentLibrary query we pull in all available results and post filter // For all sites documentLibrary query we pull in all available results and post filter
if (totalItemCount === 0) totalItemCount = -1; if (totalItemCount === 0) totalItemCount = -1;

View File

@@ -181,6 +181,8 @@ var Filters =
case "favourites": case "favourites":
for (var favourite in favourites) for (var favourite in favourites)
{
if (favourite && favourite.trim() !== "")
{ {
if (filterQuery) if (filterQuery)
{ {
@@ -188,6 +190,7 @@ var Filters =
} }
filterQuery += "ID:\"" + favourite + "\""; filterQuery += "ID:\"" + favourite + "\"";
} }
}
if (filterQuery.length !== 0) if (filterQuery.length !== 0)
{ {
@@ -201,7 +204,13 @@ var Filters =
else else
{ {
// empty favourites query // empty favourites query
filterQuery = "+ID:\"\""; logger.warn("No favourites found for user: " + person.properties.userName);
return {
query: null,
limitResults: 0,
sort: [],
language: "lucene"
};
} }
filterParams.query = filterQuery; filterParams.query = filterQuery;