modal loop prevention #992

This commit is contained in:
jokob-sk
2025-02-16 10:06:34 +11:00
parent ffa0457342
commit a0e117f92e
+4 -3
View File
@@ -310,7 +310,6 @@ function checkNotification() {
if(response != "[]") if(response != "[]")
{ {
// Find the oldest unread notification with level "interrupt" // Find the oldest unread notification with level "interrupt"
const oldestInterruptNotification = response.find(notification => notification.read === 0 && notification.level === "interrupt"); const oldestInterruptNotification = response.find(notification => notification.read === 0 && notification.level === "interrupt");
const allUnreadNotification = response.filter(notification => notification.read === 0 && notification.level === "alert"); const allUnreadNotification = response.filter(notification => notification.read === 0 && notification.level === "alert");
@@ -322,6 +321,9 @@ function checkNotification() {
const decodedContent = safeDecodeURIComponent(oldestInterruptNotification.content); const decodedContent = safeDecodeURIComponent(oldestInterruptNotification.content);
// only check and display modal if no modal currently displayed to prevent looping
if($("#modal-ok").is(":visible") == false)
{
showModalOK("Notification", decodedContent, function() { showModalOK("Notification", decodedContent, function() {
// Mark the notification as read // Mark the notification as read
$.ajax({ $.ajax({
@@ -346,10 +348,9 @@ function checkNotification() {
}); });
}); });
} }
}
handleUnreadNotifications(allUnreadNotification.length) handleUnreadNotifications(allUnreadNotification.length)
} }
}, },
error: function() { error: function() {