I initially wanted to group them as they were created, although it is difficult given that each individual notification can be shared with other users.
It gets complicated in situations like:
- Notification: User replied to topic
- Notification pushed to 4 users
- 2 of those users read that notification
- A different user replied to that topic
Now, what happens here? Do we modify the existing notification object? If we do, then the two users who read the notification already will receive a notification with incorrect data (that is, it will say two users replied to a topic, when it should say 1).
In hindsight, it might actually be better to keep notifications granular, and have each individual client handle duplication separately...
Out of curiousity (I am actually just a user of nodebb, not deverloper or anything), but then.. how is it work if they use the forum?
Example: UserA, UserB, UserC and UserD are following a topic.
- UserX writes a new reply, a notifications is sent to A, B, C and D.
- A and B enter to the forum, A reads the notification and mark it as read. B doesn't mark it as read neither read the new reply.
- A UserY writes a new reply.
What does the forum then? B, C, D should receive a notification as "two new replies" while A should receive a notification as "one new reply".
By the way, perhaps a simple solution is saying: "There are new messages in X topic" and until that the user doesn't mark as "read" the notification, he won't be notificated again.