mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: #9351 bad logic when inserting rows to privilege tables, also a missing tfoot 🦶
This commit is contained in:
@@ -363,16 +363,15 @@ define('admin/manage/privileges', [
|
||||
],
|
||||
},
|
||||
}, function (html) {
|
||||
var tableEl = document.querySelector('.privilege-table');
|
||||
var rows = tableEl.querySelectorAll('tbody tr');
|
||||
html.insertBefore(rows[rows.length - 1]);
|
||||
var tbodyEl = document.querySelector('.privilege-table tbody');
|
||||
tbodyEl.append(html.get(0));
|
||||
Privileges.exposeAssumedPrivileges();
|
||||
hightlightRowByDataAttr('data-group-name', group);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
|
||||
function addUserToCategory(user, cb) {
|
||||
async function addUserToCategory(user, cb) {
|
||||
cb = cb || function () {};
|
||||
var userRow = document.querySelector('.privilege-table [data-uid="' + user.uid + '"]');
|
||||
if (userRow) {
|
||||
@@ -385,7 +384,7 @@ define('admin/manage/privileges', [
|
||||
return memo;
|
||||
}, {});
|
||||
|
||||
app.parseAndTranslate('admin/partials/privileges/' + (isNaN(cid) ? 'global' : 'category'), 'privileges.users', {
|
||||
const html = await app.parseAndTranslate('admin/partials/privileges/' + (isNaN(cid) ? 'global' : 'category'), 'privileges.users', {
|
||||
privileges: {
|
||||
users: [
|
||||
{
|
||||
@@ -399,13 +398,13 @@ define('admin/manage/privileges', [
|
||||
},
|
||||
],
|
||||
},
|
||||
}, function (html) {
|
||||
var tableEl = document.querySelectorAll('.privilege-table');
|
||||
var rows = tableEl[1].querySelectorAll('tbody tr');
|
||||
html.insertBefore(rows[rows.length - 1]);
|
||||
});
|
||||
|
||||
var tbodyEl = document.querySelectorAll('.privilege-table tbody');
|
||||
tbodyEl[1].append(html.get(0));
|
||||
Privileges.exposeAssumedPrivileges();
|
||||
hightlightRowByDataAttr('data-uid', user.uid);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
|
||||
return Privileges;
|
||||
|
||||
@@ -135,6 +135,8 @@
|
||||
{function.spawnPrivilegeStates, privileges.users.username, ../privileges}
|
||||
</tr>
|
||||
<!-- END privileges.users -->
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="{privileges.columnCountUser}">
|
||||
<button type="button" class="btn btn-default pull-right" data-ajaxify="false" data-action="search.user">
|
||||
@@ -143,5 +145,5 @@
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
@@ -81,6 +81,8 @@
|
||||
{function.spawnPrivilegeStates, privileges.users.username, ../privileges}
|
||||
</tr>
|
||||
<!-- END privileges.users -->
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="{privileges.columnCount}">
|
||||
<button type="button" class="btn btn-default pull-right" data-ajaxify="false" data-action="search.user">
|
||||
@@ -89,5 +91,5 @@
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user