diff --git a/src/js/index.js b/src/js/index.js index cdad370a5..e5f131260 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -62,22 +62,6 @@ function asyncForEach(items, handler, callback) { })(); } -function asyncSeries(funcs, callback) { - var cur = 0; - - if (funcs.length === 0) return callback(); - - (function iterator() { - funcs[cur](function (error) { - if (error) return callback(error); - if (cur >= funcs.length-1) return callback(); - ++cur; - - iterator(); - }); - })(); -} - // create main application module var app = angular.module('Application', ['ngFitText', 'ngRoute', 'ngAnimate', 'ngSanitize', 'angular-md5', 'base64', 'slick', 'ui-notification', 'ui.bootstrap', 'ui.bootstrap-slider', 'ngTld', 'ui.multiselect']); diff --git a/src/views/app.js b/src/views/app.js index bd1ddfbf4..3f5ac6e72 100644 --- a/src/views/app.js +++ b/src/views/app.js @@ -2,7 +2,7 @@ /* global angular */ /* global $ */ -/* global asyncSeries */ +/* global async */ /* global asyncForEach */ /* global RSTATES */ /* global ISTATES */ @@ -1580,7 +1580,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location' $scope.setView($scope.app.error ? 'repair' : 'display', true /* skipViewShow */); } - asyncSeries([ + async.series([ fetchUsers, fetchGroups, getDomains, diff --git a/src/views/users.js b/src/views/users.js index 5e36a299e..ba944b0f9 100644 --- a/src/views/users.js +++ b/src/views/users.js @@ -1,10 +1,10 @@ 'use strict'; -/* global angular:false */ -/* global Clipboard:false */ -/* global asyncForEachParallel:false */ -/* global asyncSeries:false */ -/* global $:false */ +/* global angular */ +/* global Clipboard */ +/* global asyncForEachParallel */ +/* global async */ +/* global $ */ angular.module('Application').controller('UsersController', ['$scope', '$location', '$timeout', 'Client', function ($scope, $location, $timeout, Client) { Client.onReady(function () { if (!Client.getUserInfo().isAtLeastUserManager) $location.path('/'); }); @@ -167,7 +167,7 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio var groupIds = $scope.useradd.selectedGroups.map(function (g) { return g.id; }); var NOOP = function (next) { next(); }; - asyncSeries([ + async.series([ Client.setGroups.bind(Client, newUserInfo.id, groupIds), $scope.useradd.sendInvite ? Client.createInvite.bind(Client, newUserInfo.id) : NOOP, $scope.useradd.sendInvite ? Client.sendInvite.bind(Client, newUserInfo.id) : NOOP