settings: Move the user-privacy settings related code at one place.

This commit makes small refactoring to place all the user-privacy
settings code in 'server_events_dispatch.js' at one place and use
a common function 'settings_account.update_privacy_settings_box' to
update the UI.

This also helps in early return instead of executing a lot
of `if` statements related to user-preferences settings.
This commit is contained in:
Prakhar Pratyush
2024-09-09 20:14:55 +05:30
committed by Tim Abbott
parent 75f6ae6d20
commit 00fb8f3014
2 changed files with 6 additions and 11 deletions

View File

@@ -1117,6 +1117,7 @@ run_test("user_settings", ({override}) => {
event = event_fixtures.user_settings__presence_disabled;
user_settings.presence_enabled = true;
override(activity_ui, "redraw_user", noop);
override(settings_account, "update_privacy_settings_box", noop);
dispatch(event);
assert_same(user_settings.presence_enabled, false);