Changeset 834bcc3 in Klonkt for src/services/NotificationService.js
- Timestamp:
- 06/23/2026 06:14:27 PM (3 months ago)
- Branches:
- main
- Children:
- d774679
- Parents:
- bb42dfb
- File:
-
- 1 edited
-
src/services/NotificationService.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/services/NotificationService.js
rbb42dfb r834bcc3 1 1 /** 2 * Meldingen — antwoord op je reactie, reactie op je post, like op jepost.3 * Voor élke ingelogde gebruiker (Google-bezoekers/fans én admin). Snapshots van4 * actor -naam + post-titel zodat de lijst zonder joins te tonen is.2 * Notifications — reply to your comment, comment on your post, like on your post. 3 * For every logged-in user (Google visitors/fans and admins). Snapshots of 4 * actor name + post title so the list can be rendered without joins. 5 5 */ 6 6 import { randomUUID } from 'crypto'; 7 7 import db from '../config/database.js'; 8 8 9 // Maakt een melding aan. Doet niets als er geen ontvanger is of als je jezelf10 // zou notificeren (eigen reactie/like op eigen post/reactie).9 // Creates a notification. Does nothing if there is no recipient or if you 10 // would notify yourself (your own comment/like on your own post/comment). 11 11 export function notify({ userId, actorId, actorName, type, postSlug, postTitle, url }) { 12 12 if (!userId || userId === actorId) return; … … 16 16 VALUES (?, ?, ?, ?, ?, ?, ?, ?, 0) 17 17 `).run(randomUUID(), userId, type, actorId || null, actorName || null, postSlug || null, postTitle || null, url || null); 18 } catch { /* meldingen zijn niet-fataal */ }18 } catch { /* notifications are non-fatal */ } 19 19 } 20 20 … … 33 33 export function markAllRead(userId) { 34 34 if (!userId) return; 35 try { db.prepare('UPDATE user_notifications SET read = 1 WHERE user_id = ? AND read = 0').run(userId); } catch { /* no op */ }35 try { db.prepare('UPDATE user_notifications SET read = 1 WHERE user_id = ? AND read = 0').run(userId); } catch { /* no-op */ } 36 36 } 37 37
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)