settings: Prevent save discard widget override.

This commit prevents the save button in the save discard widget from
showing the "Saved" label when the user has made some other changes
in the settings while the saving process was in action — which resulted
in the "Save changes" label in the save button, and thus shouldn't be
replaced with "Saved".

This commit also fixes the failing puppeteer tests in
`web/e2e-tests/admin.test.ts` which was introduced in #34081.

(cherry picked from commit 7b45ff50ba)
This commit is contained in:
Sayam Samal
2025-04-09 06:01:58 +05:30
committed by Tim Abbott
parent c1be1e0116
commit 2e4fca6daa

View File

@@ -560,6 +560,13 @@ export function change_save_button_state($element: JQuery, state: string): void
return; return;
} }
if (state === "succeeded" && $save_button.attr("data-status") === "unsaved") {
// We don't show the "saved" state if the save button is in the "unsaved"
// state, as that would indicate that user has made some other changes
// during the saving process.
return;
}
if (state !== "saving") { if (state !== "saving") {
buttons.hide_button_loading_indicator($save_button); buttons.hide_button_loading_indicator($save_button);
} }