settings: Don't show last active in deactivated users table.

Fixed #29894.
We were using `is_active` to determine whether to show that column or
not. In case of deactivated table, on reactivating a user, `is_active`
will become true for that user, but we still don't want to show that
column and mess up our layout. Same would happen in the active users
table when a user was deactivated and the `is_active` would become
false. It is better to control the column to be shown on a per-table
basis and we introduced `display_last_active_column` to control that.

Co-authored-by: shubham-padia <shubham@zulip.com>
This commit is contained in:
dhruv-goyal-10 2024-05-07 19:56:58 +05:30 committed by Tim Abbott
parent af3a2500df
commit 0dc8402221
2 changed files with 8 additions and 7 deletions

View File

@ -276,12 +276,11 @@ function human_info(person) {
info.cannot_deactivate = info.is_current_user || (person.is_owner && !current_user.is_owner);
info.display_email = person.delivery_email;
if (info.is_active) {
// TODO: We might just want to show this
// for deactivated users, too, even though
// it might usually just be undefined.
info.last_active_date = get_last_active(person);
}
// TODO: This is not shown in deactivated users table and it is
// controlled by `display_last_active_column` We might just want
// to show this for deactivated users, too, even though it might
// usually just be undefined.
info.last_active_date = get_last_active(person);
return info;
}
@ -336,6 +335,7 @@ section.active.create_table = (active_users) => {
get_item: people.get_by_user_id,
modifier_html(item) {
const info = human_info(item);
info.display_last_active_column = true;
return render_admin_user_list(info);
},
filter: {
@ -370,6 +370,7 @@ section.deactivated.create_table = (deactivated_users) => {
get_item: people.get_by_user_id,
modifier_html(item) {
const info = human_info(item);
info.display_last_active_column = false;
return render_admin_user_list(info);
},
filter: {

View File

@ -34,7 +34,7 @@
<td class="bot_type">
<span class="bot type">{{bot_type}}</span>
</td>
{{else if is_active}}
{{else if display_last_active_column}}
<td class="last_active">
{{ last_active_date }}
</td>