diff --git a/frontend_tests/node_tests/templates.js b/frontend_tests/node_tests/templates.js
index 369a844fa9..31d32c1cf5 100644
--- a/frontend_tests/node_tests/templates.js
+++ b/frontend_tests/node_tests/templates.js
@@ -375,11 +375,8 @@ run_test('admin_user_list', () => {
assert.equal($(buttons[0]).text().trim(), "translated: Deactivate");
assert($(buttons[0]).hasClass("deactivate"));
- assert.equal($(buttons[1]).text().trim(), "translated: Make admin");
- assert($(buttons[1]).hasClass("make-admin"));
-
- assert.equal($(buttons[2]).attr('title').trim(), "translated: Edit user");
- assert($(buttons[2]).hasClass("open-user-form"));
+ assert.equal($(buttons[1]).attr('title').trim(), "translated: Edit user");
+ assert($(buttons[1]).hasClass("open-user-form"));
// When the logged in user is not admin
html = '
';
diff --git a/static/js/settings_users.js b/static/js/settings_users.js
index 3b12d62cf2..cee6e135b9 100644
--- a/static/js/settings_users.js
+++ b/static/js/settings_users.js
@@ -304,13 +304,14 @@ exports.on_load_success = function (realm_people_data) {
});
});
- $(".admin_user_table").on("click", ".make-admin", function (e) {
+ var user_info_form_modal_container = $("#user-info-form-modal-container");
+
+ user_info_form_modal_container.on("click", ".make-admin", function (e) {
e.preventDefault();
e.stopPropagation();
// Go up the tree until we find the user row, then grab the user_id data
- var row = $(e.target).closest(".user_row");
- var user_id = row.attr("data-user-id");
+ var user_id = user_info_form_modal_container.find('#user-name-form').attr("data-user-id");
var url = "/json/users/" + encodeURIComponent(user_id);
var data = {
@@ -321,7 +322,7 @@ exports.on_load_success = function (realm_people_data) {
url: url,
data: data,
success: function () {
- var button = row.find("button.make-admin");
+ var button = user_info_form_modal_container.find("button.make-admin");
button.addClass("btn-danger");
button.removeClass("btn-warning");
button.addClass("remove-admin");
@@ -335,13 +336,12 @@ exports.on_load_success = function (realm_people_data) {
});
});
- $(".admin_user_table").on("click", ".remove-admin", function (e) {
+ user_info_form_modal_container.on("click", ".remove-admin", function (e) {
e.preventDefault();
e.stopPropagation();
// Go up the tree until we find the user row, then grab the user_id data
- var row = $(e.target).closest(".user_row");
- var user_id = row.attr("data-user-id");
+ var user_id = user_info_form_modal_container.find('#user-name-form').attr("data-user-id");
var url = "/json/users/" + encodeURIComponent(user_id);
var data = {
@@ -352,7 +352,7 @@ exports.on_load_success = function (realm_people_data) {
url: url,
data: data,
success: function () {
- var button = row.find("button.remove-admin");
+ var button = user_info_form_modal_container.find("button.remove-admin");
button.addClass("btn-warning");
button.removeClass("btn-danger");
button.addClass("make-admin");
@@ -370,6 +370,7 @@ exports.on_load_success = function (realm_people_data) {
var html = templates.render('user-info-form-modal', {
user_id: person.user_id,
full_name: people.get_full_name(person.user_id),
+ is_admin: person.is_admin,
is_bot: person.is_bot,
});
var user_info_form_modal = $(html);
diff --git a/static/templates/admin_user_list.handlebars b/static/templates/admin_user_list.handlebars
index 28a44ec82b..45f9f29976 100644
--- a/static/templates/admin_user_list.handlebars
+++ b/static/templates/admin_user_list.handlebars
@@ -33,19 +33,6 @@
{{/if}}
-
- {{#if is_active_human}}
- {{#if is_admin}}
-
- {{else}}
-
- {{/if}}
- {{/if}}
-
diff --git a/static/templates/user-info-form-modal.handlebars b/static/templates/user-info-form-modal.handlebars
index ee0a78e052..0bdfa01742 100644
--- a/static/templates/user-info-form-modal.handlebars
+++ b/static/templates/user-info-form-modal.handlebars
@@ -4,7 +4,7 @@