mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 14:35:27 +00:00
Display deactivated users at the bottom of the admin users page.
(imported from commit 1a5d5d64fffc9ed7633d468b975dd56c28f85ccf)
This commit is contained in:
@@ -2,36 +2,55 @@ var admin = (function () {
|
||||
|
||||
var exports = {};
|
||||
|
||||
function populate_users () {
|
||||
function populate_users (realm_people_data) {
|
||||
var users_table = $("#admin_users_table");
|
||||
var deactivated_users_table = $("#admin_deactivated_users_table");
|
||||
var bots_table = $("#admin_bots_table");
|
||||
users_table.empty();
|
||||
deactivated_users_table.empty();
|
||||
bots_table.empty();
|
||||
|
||||
var humans = [];
|
||||
var active_users = [];
|
||||
var deactivated_users = [];
|
||||
var bots = [];
|
||||
|
||||
realm_people_dict.each(function (user) {
|
||||
_.each(realm_people_data.members, function (user) {
|
||||
if (user.is_bot) {
|
||||
bots.push(user);
|
||||
} else if (user.is_active) {
|
||||
active_users.push(user);
|
||||
} else {
|
||||
humans.push(user);
|
||||
deactivated_users.push(user);
|
||||
}
|
||||
});
|
||||
|
||||
humans = _.sortBy(humans, 'full_name');
|
||||
active_users = _.sortBy(active_users, 'full_name');
|
||||
deactivated_users = _.sortBy(deactivated_users, 'full_name');
|
||||
bots = _.sortBy(bots, 'full_name');
|
||||
|
||||
_.each(bots, function (user) {
|
||||
bots_table.append(templates.render("admin_user_list", {user: user}));
|
||||
});
|
||||
_.each(humans, function (user) {
|
||||
_.each(active_users, function (user) {
|
||||
users_table.append(templates.render("admin_user_list", {user: user}));
|
||||
});
|
||||
_.each(deactivated_users, function (user) {
|
||||
deactivated_users_table.append(templates.render("admin_user_list", {user: user}));
|
||||
});
|
||||
}
|
||||
|
||||
exports.setup_page = function () {
|
||||
populate_users();
|
||||
function failed_listing(xhr, error) {
|
||||
ui.report_error("Error listing streams or subscriptions", xhr, $("#subscriptions-status"));
|
||||
}
|
||||
|
||||
var req = $.ajax({
|
||||
type: 'GET',
|
||||
url: '/json/users',
|
||||
dataType: 'json',
|
||||
timeout: 10*1000,
|
||||
success: populate_users,
|
||||
error: failed_listing
|
||||
});
|
||||
|
||||
$(".admin_user_table").on("click", ".deactivate", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -7,9 +7,15 @@
|
||||
<span class="email">{{email}}</span>
|
||||
</td>
|
||||
<td>
|
||||
{{#if is_active}}
|
||||
<button class="btn deactivate btn-danger">
|
||||
Deactivate
|
||||
</button>
|
||||
{{else}}
|
||||
<button class="btn reactivate btn-warning">
|
||||
Reactivate
|
||||
</button>
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/with}}
|
||||
|
||||
@@ -20,6 +20,14 @@
|
||||
<th>Actions</th>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2>Deactivated Users</h2>
|
||||
<table class="table table-condensed table-striped">
|
||||
<tbody id="admin_deactivated_users_table" class="admin_user_table">
|
||||
<th>Name</th>
|
||||
<th>Email</th>
|
||||
<th>Actions</th>
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="deactivation_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="deactivation_modal_label" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
|
||||
Reference in New Issue
Block a user