Merge branch 'MDL-59845-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Jake Dallimore 2018-05-04 09:43:14 +08:00
commit 2566b18a31
2 changed files with 10 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -130,6 +130,11 @@ define(['jquery',
* @return {Promise}
*/
PlanActions.prototype._callAndRefresh = function(calls, planData) {
// Because this function causes a refresh, we must track the JS completion from start to finish to prevent
// stale reference issues in Behat.
var callKey = 'tool_lp/planactions:_callAndRefresh-' + Math.floor(Math.random() * Math.floor(1000));
M.util.js_pending(callKey);
var self = this;
calls.push({
methodname: self._contextMethod,
@ -141,7 +146,10 @@ define(['jquery',
.then(function() {
return self._renderView(arguments[arguments.length - 1]);
})
.fail(notification.exception);
.fail(notification.exception)
.always(function() {
return M.util.js_complete(callKey);
});
};
/**