settings: Improve UI for displaying reactivated and deactivated users.

Earlier when a user is deactivated or reactivated from users
table and deactivated_users table the `Role` column was modified.

This commit changes this and now `Role` column is not modified
instead now the corresponding row is greyed out.

Fixes #21653.
This commit is contained in:
Ujjawal Modi 2023-06-28 23:13:23 +05:30 committed by Tim Abbott
parent ba1405df96
commit 0e5bb92111
2 changed files with 11 additions and 14 deletions

View File

@ -70,37 +70,25 @@ export function update_view_on_deactivate(user_id) {
} }
const $button = $row.find("button.deactivate"); const $button = $row.find("button.deactivate");
const $user_role = $row.find(".user_role");
$button.prop("disabled", false); $button.prop("disabled", false);
$row.find("button.open-user-form").hide(); $row.find("button.open-user-form").hide();
$row.find("i.deactivated-user-icon").show(); $row.find("i.deactivated-user-icon").show();
$button.addClass("btn-warning reactivate"); $button.addClass("btn-warning reactivate");
$button.removeClass("deactivate btn-danger"); $button.removeClass("deactivate btn-danger");
$button.empty().append($("<i>").addClass(["fa", "fa-user-plus"]).attr("aria-hidden", "true")); $button.empty().append($("<i>").addClass(["fa", "fa-user-plus"]).attr("aria-hidden", "true"));
$row.removeClass("reactivated_user");
$row.addClass("deactivated_user"); $row.addClass("deactivated_user");
if ($user_role) {
const user_id = $row.data("user-id");
$user_role.text(
`${$t({defaultMessage: "Deactivated"})} (${people.get_user_type(user_id)})`,
);
}
} }
function update_view_on_reactivate($row) { function update_view_on_reactivate($row) {
const $button = $row.find("button.reactivate"); const $button = $row.find("button.reactivate");
const $user_role = $row.find(".user_role");
$row.find("button.open-user-form").show(); $row.find("button.open-user-form").show();
$row.find("i.deactivated-user-icon").hide(); $row.find("i.deactivated-user-icon").hide();
$button.addClass("btn-danger deactivate"); $button.addClass("btn-danger deactivate");
$button.removeClass("btn-warning reactivate"); $button.removeClass("btn-warning reactivate");
$button.empty().append($("<i>").addClass(["fa", "fa-user-times"]).attr("aria-hidden", "true")); $button.empty().append($("<i>").addClass(["fa", "fa-user-times"]).attr("aria-hidden", "true"));
$row.removeClass("deactivated_user"); $row.removeClass("deactivated_user");
$row.addClass("reactivated_user");
if ($user_role) {
const user_id = $row.data("user-id");
$user_role.text(people.get_user_type(user_id));
}
} }
function get_status_field() { function get_status_field() {

View File

@ -2050,6 +2050,15 @@ $option_title_width: 180px;
} }
} }
#admin_users_table .deactivated_user,
#admin_deactivated_users_table .reactivated_user {
color: hsl(0deg 0% 64%);
& a {
color: inherit;
}
}
.settings_url_input, .settings_url_input,
.settings_text_input { .settings_text_input {
padding: 4px 6px; padding: 4px 6px;