Cleanup work

This commit is contained in:
jokob-sk
2024-08-11 21:13:12 +10:00
parent 3cde177e01
commit fff1f36b61
10 changed files with 43 additions and 309 deletions

View File

@@ -242,6 +242,18 @@ $(document).ready(function () {
});
// -----------------------------------------------------------------------------
// Escape text
function safeDecodeURIComponent(content) {
try {
return decodeURIComponent(content);
} catch (error) {
console.warn('Failed to decode URI component:', error);
return content; // Return the original content if decoding fails
}
}
// -----------------------------------------------------------------------------
// Backend notification Polling
// -----------------------------------------------------------------------------
@@ -266,7 +278,9 @@ function checkNotification() {
if (oldestInterruptNotification) {
// Show modal dialog with the oldest unread notification
const decodedContent = decodeURIComponent(oldestInterruptNotification.content);
console.log(oldestInterruptNotification.content);
const decodedContent = safeDecodeURIComponent(oldestInterruptNotification.content);
showModalOK("Notification", decodedContent, function() {
// Mark the notification as read