From ea5b6be433db8b1cda7886a215f8898821645d9b Mon Sep 17 00:00:00 2001 From: Vector73 Date: Tue, 26 Mar 2024 15:51:53 +0530 Subject: [PATCH] navbar_alert: Fix wierd closing of profile-missing-required alert. This is a follow-up for #28924 to fix weird closing behavior of navbar alert which is used to show the presence of empty required profile fields. --- web/src/navbar_alerts.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/web/src/navbar_alerts.js b/web/src/navbar_alerts.js index c9b32249c1..c7aa8bdf28 100644 --- a/web/src/navbar_alerts.js +++ b/web/src/navbar_alerts.js @@ -73,6 +73,7 @@ export function should_show_server_upgrade_notification(ls) { } export function maybe_show_empty_required_profile_fields_alert() { + const $navbar_alert = $("#navbar_alerts_wrapper").children(".alert").first(); const empty_required_profile_fields_exist = realm.custom_profile_fields .map((f) => ({ ...f, @@ -80,15 +81,13 @@ export function maybe_show_empty_required_profile_fields_alert() { })) .find((f) => f.required && !f.value); if (!empty_required_profile_fields_exist) { + if ($navbar_alert.data("process") === "profile-missing-required") { + $navbar_alert.hide(); + } return; } - const $navbar_alert = $("#navbar_alerts_wrapper").children(".alert").first(); - if ( - !$navbar_alert?.length || - $navbar_alert.is("#empty-required-profile-fields-warning") || - $navbar_alert.is(":hidden") - ) { + if (!$navbar_alert?.length || $navbar_alert.is(":hidden")) { open({ data_process: "profile-missing-required", rendered_alert_content_html: render_empty_required_profile_fields(), @@ -236,7 +235,9 @@ export function initialize() { show_step($process, 2); } else { $(this).closest(".alert").hide(); - maybe_show_empty_required_profile_fields_alert(); + if ($process.data("process") !== "profile-missing-required") { + maybe_show_empty_required_profile_fields_alert(); + } } $(window).trigger("resize"); });