Skip to content

Commit

Permalink
MDL-57604 mod_assign: fix empty case in user selector
Browse files Browse the repository at this point in the history
Sadly the js arguments object gives an arguments.length of 1 when
no arguments are passed, so we have to explicitly check for it.
  • Loading branch information
danpoltawski authored and stronk7 committed Jan 18, 2017
1 parent c2a9f46 commit c52766a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mod/assign/amd/build/participant_selector.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions mod/assign/amd/src/participant_selector.js
Expand Up @@ -95,8 +95,14 @@ define(['core/ajax', 'jquery', 'core/templates'], function(ajax, $, templates) {
// Do the dance for $.when()
return $.when.apply($, promises);
}).then(function() {
// Undo the $.when() dance from arguments object into an array..
var users = Array.prototype.slice.call(arguments);
var users = [];

// Determine if we've been passed any arguments..
if (arguments[0]) {
// Undo the $.when() dance from arguments object into an array..
users = Array.prototype.slice.call(arguments);
}

success(users);
}).catch(failure);
}
Expand Down

0 comments on commit c52766a

Please sign in to comment.