fix issue where not all seen items where removed from the notifications

This commit is contained in:
Mario
2025-10-13 19:58:12 +00:00
parent c748d3f0f8
commit d24a3a2713
2 changed files with 13 additions and 18 deletions

View File

@@ -70,7 +70,7 @@ require_once('include/security.php');
define('PLATFORM_NAME', 'hubzilla');
define('STD_VERSION', '10.5.10');
define('STD_VERSION', '10.5.11');
define('ZOT_REVISION', '6.0');
define('DB_UPDATE_VERSION', 1264);

View File

@@ -584,19 +584,21 @@
}
function sse_updateNotifications(type, mid) {
function sse_updateNotifications(mid) {
// Find the notification elements based on its 'data-b64mid' or href attribute.
// The latter will match reactions where b64mid will contain the uuid of its thread parent (reacted on) instead of its own.
let notifications = document.querySelectorAll(`.notification[data-b64mid='${mid}'], .notification[href*='display/${mid}']`);
// Skip processing if the type is 'notify' and the conditions don't match
if (type === 'notify' && (mid !== bParam_mid || sse_type !== 'notify')) {
return true;
}
notifications.forEach(notification => {
let type = notification.parentElement.id.split('-')[1];
// Find the notification element based on its 'data-b64mid' attribute
let notification = document.querySelector(`#nav-${type}-menu .notification[data-b64mid='${mid}']`);
// Skip processing if the type is 'notify' and the conditions don't match
if (type === 'notify' && (mid !== bParam_mid || sse_type !== 'notify')) {
return true;
}
if (notification) {
notification.remove();
}
});
}
@@ -659,14 +661,7 @@
if (data) {
data.forEach(function (nmid) {
sse_rmids.push(nmid);
// Handle regular notifications
let notification = document.querySelector(`.notification[data-b64mid='${nmid}']`);
if (notification) {
let parentId = notification.parentElement.id.split('-')[1];
sse_updateNotifications(parentId, nmid);
}
sse_updateNotifications(nmid);
});
}
}