Permalink
Browse files

MDL-57604 mod_assign: fix empty case in user selector

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 c52766af644ceff2cb02f6c4e467511c8ad1b43e
Showing with 9 additions and 3 deletions.
  1. +1 −1 mod/assign/amd/build/participant_selector.min.js
  2. +8 −2 mod/assign/amd/src/participant_selector.js

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -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);
}

0 comments on commit c52766a

Please sign in to comment.