From 2e4fca6daaa7b0c246aba5f81cc9d2c7f8d656b0 Mon Sep 17 00:00:00 2001 From: Sayam Samal Date: Wed, 9 Apr 2025 06:01:58 +0530 Subject: [PATCH] settings: Prevent save discard widget override. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 7b45ff50ba25634a901adc926a352efd7501df43) --- web/src/settings_components.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/src/settings_components.ts b/web/src/settings_components.ts index 2f077ea676..60734ba66d 100644 --- a/web/src/settings_components.ts +++ b/web/src/settings_components.ts @@ -560,6 +560,13 @@ export function change_save_button_state($element: JQuery, state: string): void 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") { buttons.hide_button_loading_indicator($save_button); }