Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

users_list: Fix updating of users list on reactivate/deactivate. #14288

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
settings: Fix updating of active/deactivated user list.
Previously, when a user was deactivated, the user was
added in the deactivated users list only after opening
the settings menu again or reloading, but now the user
is added to the deactivated users list if we open the
deactivated users section. Note that sticky behavior
is stil present which means that the deactivated user
will still be present in the active users list until
we go away from that section.

And the behavior is same for reactivating a user from
deactivated users list.
  • Loading branch information
sahil839 committed Jul 20, 2021
commit 73f3e276fa2960ed8925ead42d6e5b31f51686c0
4 changes: 4 additions & 0 deletions static/js/settings_sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,7 @@ export function reset_sections() {
settings_muted_users.reset();
// settings_users doesn't need a reset()
}

export function reset_users_section() {
loaded_groups.delete("org_users");
}
12 changes: 10 additions & 2 deletions static/js/settings_users.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import * as settings_bots from "./settings_bots";
import * as settings_config from "./settings_config";
import * as settings_data from "./settings_data";
import * as settings_panel_menu from "./settings_panel_menu";
import * as settings_sections from "./settings_sections";
import * as settings_ui from "./settings_ui";
import * as timerender from "./timerender";
import * as ui from "./ui";
Expand All @@ -35,6 +36,8 @@ const section = {
bots: {},
};

let events_registered = false;

function compare_a_b(a, b) {
if (a > b) {
return 1;
Expand Down Expand Up @@ -434,6 +437,7 @@ function confirm_deactivation(row, user_id, status_field) {
const opts = {
success_continuation() {
update_view_on_deactivate(row);
settings_sections.reset_users_section();
},
error_continuation() {
row_deactivate_button.text($t({defaultMessage: "Deactivate"}));
Expand Down Expand Up @@ -501,6 +505,7 @@ function handle_reactivation(tbody, status_field) {
const opts = {
success_continuation() {
update_view_on_reactivate(row);
settings_sections.reset_users_section();
},
error_continuation(xhr) {
ui_report.generic_row_button_error(xhr, button_elem);
Expand Down Expand Up @@ -695,8 +700,11 @@ section.bots.handle_events = () => {

export function set_up_humans() {
start_data_load();
section.active.handle_events();
section.deactivated.handle_events();
if (!events_registered) {
events_registered = true;
section.active.handle_events();
section.deactivated.handle_events();
}
}

export function set_up_bots() {
Expand Down