handle_ajax_return(): only display success_message if no other message is provided and fix auto-dismiss it

This commit is contained in:
Benjamin Renard 2024-12-28 01:44:59 +01:00
parent e48d1224f6
commit 075519220b
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -182,10 +182,11 @@ function handle_ajax_return(
});
if (data && data.success) {
if (success_message) alertify.notify(success_message, "success");
if (!(data.messages && data.messages.length) && success_message)
alertify.notify(success_message, "success", 5);
return true;
}
if (!data.errors)
if (!(data.errors && data.errors.length))
alertify.notify(
default_error ??
_(