Review Board 1.7.22


change if condition in actions_container.js due to runAction function receives an empty array when it calls the registry.getGadgetSites instead of "undefined"

Review Request #4216 - Created March 7, 2012 and submitted

Yao Zhang
SHINDIG-1723
Reviewers
shindig
hsaputra
shindig
runAction function receives an empty array when it calls the registry.getGadgetSites instead of "undefined", which is what it receives when gadget loading works in earlier builds. Therefore, the first section in "if (!gadgetSites)" below doesn't get run and instead it incorrectly goes to the "else". .getGadgetSites appears to now always return an array and it will be empty if there aren't any sites instead of "undefined" like in the past.

runAction: function(actionId, opt_selection) {
var action = registry.getItemById(actionId);
if (action) {
// if gadget site has not been registered yet
// the gadget needs to be rendered
var gadgetSites = registry.getGadgetSites(actionId);
if (!gadgetSites) {
var gadgetUrl = registry.getUrl(actionId);
pendingActions[actionId] = {
selection: opt_selection || container_.selection.getSelection()
};
// set optional params
......
}, 
Done.
Ship it!
Posted (March 7, 2012, 2:23 p.m.)
LGTM, nice catch.
Posted (March 7, 2012, 2:26 p.m.)
Please attach your patch to the JIRA and grant apache license.
Ship it!
Posted (March 8, 2012, 3:01 p.m.)
Thanks for the patch! committed with revision 1298423.