NotificationHistory: better display for unread notifications

This commit is contained in:
Ly-sec 2025-09-07 15:09:30 +02:00
parent 4578aad0bc
commit a2ea3c116d
3 changed files with 21 additions and 6 deletions

View file

@ -201,12 +201,17 @@ Singleton {
const items = historyAdapter.history || []
for (var i = 0; i < items.length; i++) {
const it = items[i]
// Coerce legacy second-based timestamps to milliseconds
var ts = it.timestamp
if (typeof ts === "number" && ts < 1e12) {
ts = ts * 1000
}
historyModel.append({
"summary": it.summary || "",
"body": it.body || "",
"appName": it.appName || "",
"urgency": it.urgency,
"timestamp": it.timestamp ? new Date(it.timestamp) : new Date()
"timestamp": ts ? new Date(ts) : new Date()
})
}
} catch (e) {
@ -225,7 +230,10 @@ Singleton {
"body": n.body,
"appName": n.appName,
"urgency": n.urgency,
"timestamp": (n.timestamp instanceof Date) ? n.timestamp.getTime() : n.timestamp
"timestamp"// Always persist in milliseconds
: (n.timestamp instanceof Date) ? n.timestamp.getTime(
) : (typeof n.timestamp === "number"
&& n.timestamp < 1e12 ? n.timestamp * 1000 : n.timestamp)
})
}
historyAdapter.history = arr