Skip to content

Commit

Permalink
fix: map instead of forEach in privileges save
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Aug 4, 2020
1 parent a716a55 commit a7071bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions public/src/admin/manage/privileges.js
Expand Up @@ -60,13 +60,13 @@ define('admin/manage/privileges', [
bootbox.confirm('[[admin/manage/privileges:alert.confirm-save]]', function (ok) {
if (ok) {
var tableEl = document.querySelector('.privilege-table-container');
var requests = tableEl.querySelectorAll('td[data-delta]').forEach(function (el) {
var requests = $.map(tableEl.querySelectorAll('td[data-delta]'), function (el) {
var privilege = el.getAttribute('data-privilege');
var rowEl = el.parentNode;
var member = rowEl.getAttribute('data-group-name') || rowEl.getAttribute('data-uid');
var state = el.getAttribute('data-delta') === 'true' ? 1 : 0;

Privileges.setPrivilege(member, privilege, state);
return Privileges.setPrivilege(member, privilege, state);
});

$.when(requests).done(function () {
Expand Down

0 comments on commit a7071bb

Please sign in to comment.