mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-15 22:51:37 -07:00
modal loop prevention #992
This commit is contained in:
+4
-3
@@ -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() {
|
||||||
|
|||||||
Reference in New Issue
Block a user