settings: Add functions to discard complete subsection.

This commit adds new functions which will be used to discard
changes for all the settings in a subsection when clicking
on discard button. This change will help in avoiding code
duplication when they will be used to discard changes in
a subsection if some other user changed a setting in the
same subsection.
This commit is contained in:
Sahil Batra
2024-06-28 16:53:35 +05:30
committed by Tim Abbott
parent da95d01c37
commit cb69a819d4
4 changed files with 47 additions and 22 deletions

View File

@@ -916,11 +916,7 @@ export function initialize() {
const group = user_groups.get_user_group_from_id(group_id);
const $subsection = $(e.target).closest(".settings-subsection-parent");
for (const elem of settings_components.get_subsection_property_elements($subsection)) {
settings_org.discard_group_property_element_changes(elem, group);
}
const $save_btn_controls = $(e.target).closest(".save-button-controls");
settings_components.change_save_button_state($save_btn_controls, "discarded");
settings_org.discard_group_settings_subsection_changes($subsection, group);
},
);
}