mirror of https://github.com/zulip/zulip.git
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.
This commit is contained in:
parent
38b2988e0f
commit
ea5b6be433
|
@ -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,8 +235,10 @@ export function initialize() {
|
|||
show_step($process, 2);
|
||||
} else {
|
||||
$(this).closest(".alert").hide();
|
||||
if ($process.data("process") !== "profile-missing-required") {
|
||||
maybe_show_empty_required_profile_fields_alert();
|
||||
}
|
||||
}
|
||||
$(window).trigger("resize");
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue