Fix for ALF-20023 Recent Sites and Favourite Sites in copy/move pickers empty

So the bug was caused by 2 problems: one in ScriptPreferenceService and one in person.sites.get.js
The first problem was that ScriptPreferenceService constructs raw Mozilla NativeObjects - a very unusual practice in itself - and it does not provide a default value as required by ECMA 9.1 from the ECMA standard. I've added this code to the NativeObject (can't change the type to ScriptableHashMap<K, V> or similar as the API is published).
I've also fixed the same bug (unreported, possibly never apparent) in a jbpm class.
The second problem was that person.sites.get.js simply could never return preferences data if the caller provided a filter (favourites or recents) and did not also provide a page size.
There was a logic error in the algorithm such that the size defaulted to 0 thus providing a 'page' of zero results as a default.
I assume this is a merge error from cloud, but I don't know.
I added tests for the JavaScript API's favourites/recents filter calls and logging here and there.
Also deleted some dead code.



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@55474 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Neil McErlean
2013-09-18 15:27:51 +00:00
parent d747320512
commit a326b7a01c

View File

@@ -58,7 +58,7 @@ function main()
}
var i = 0;
while (filteredSites.length < size && i < sites.length)
while (i < sites.length)
{
for (var key in filterObj)
{
@@ -68,6 +68,13 @@ function main()
filterObj[key] == true)
{
filteredSites.push(sites[i]);
// If the caller of this webscript has requested a specific result size (non-zero) then do not return more than they asked for
if (size > 0 && filteredSites.length == size)
{
break;
}
}
}
}