Changeset e951b7c in Klonkt for src/services/ActivityPubService.js
- Timestamp:
- 06/25/2026 05:22:51 AM (3 months ago)
- Branches:
- main
- Children:
- 4c9c60b
- Parents:
- d7526bd
- File:
-
- 1 edited
-
src/services/ActivityPubService.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/services/ActivityPubService.js
rd7526bd re951b7c 169 169 } catch { /* non-fatal */ } 170 170 return out; 171 } 172 173 // Notifications "seen" tracking → a real bell badge. Stored per site in app_settings. 174 export function markNotificationsSeen(slug) { 175 try { 176 db.prepare("INSERT INTO app_settings (key, value, updated_at) VALUES (?, ?, CURRENT_TIMESTAMP) ON CONFLICT(key) DO UPDATE SET value = excluded.value, updated_at = CURRENT_TIMESTAMP") 177 .run(`fedi_notif_seen:${slug}`, new Date().toISOString()); 178 } catch { /* non-fatal */ } 179 } 180 export function countUnseenNotifications(slug) { 181 try { 182 const row = db.prepare('SELECT value FROM app_settings WHERE key = ?').get(`fedi_notif_seen:${slug}`); 183 const seen = row ? Date.parse(row.value) : 0; 184 let n = 0; 185 for (const it of getNotifications(slug, 50)) { if (Date.parse(it.created_at) > seen) n++; } 186 return n; 187 } catch { return 0; } 171 188 } 172 189 … … 919 936 getNotifications, listBlocks, isBlockedAny, blockTarget, unblock, 920 937 deliverWithRetry, enqueueDelivery, processDeliveryQueue, startDeliveryWorker, 921 getReplyUris, 938 getReplyUris, markNotificationsSeen, countUnseenNotifications, 922 939 };
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)