Mark notification as read

The only way I see to implement a system to “mark as read” or “mark as unread” for notifications would be to use the storage service to store a set (list, array, etc) of read/unread notification ids.

currently notifications cannot be edited, not even serverside, right? deleting the notification and re-adding it with a read:true in the content seems a bit counterproductive since my cursor and ordering would fly out the window :cry:

Edit:
Just to hack stuff… if I were to tamper with the database similar to nakama/server/core_notification.go at e3f170cd081b18338cc863f1f86b8ea795d36939 · heroiclabs/nakama · GitHub but with an update command… could it work? (I know this is not the expected way of doing stuff, but it could work :eyes: )

Hello @elementalcode,

Since we don’t currently provide an API to update a notification content, a custom query is fine for this purpose, I’d suggest using something like:

UPDATE notification SET content = content || '{"read":true}'::jsonb WHERE id = '<notification_id>';

Best

1 Like