Opinions wanted! Best method for keeping track of "un-viewed" / "new" items

I’m making an app using a list of calls. By calls I mean events to be tracked.

An event can have comments, and persons assigned, and status for those persons, and so on. There could be multiple people in charge of monitoring these events, and assigning / moving / de-assigning persons, and adding or editing comments.

What I’m trying to do is make sure that as new assignments / or changes are made, or new comments or changes are added to comments, the person who made them isn’t given an indicator that it’s new or changed, but all of the people who didn’t make it are notified.

I’ve started down the road of observeChanges, an dam getting some results, but my list of events all show an icon when only 1 event’s comment is updated.

My question is this:

Is it better to track in the database which users have ‘viewed’ the new or changed info. I would track this through a mouse click on the tab that allows them to view the information that’s “New”.

Or is there too much overhead adding that to the db?

How do chat messaging systems track new, delivered, read, and so on, particularly in multi-person messaging situations?

Just looking for some loose guidance right now.

It seems like “unviewed/viewed” and “new” items are two different sets.

Best to track as little data as possible, and put that data in a place you’re already accessing when you need it.

I’d push “viewed” items into an array of ID’s on the user. You’ll know an item is un-viewed if it’s not in that array.

I’d push “new” items into an array of ID’s on the user. Your notifications code can remove it when the user interacts with it.

This favors read performance over write performance and assumes you’re working with small viewed/new sets compared to your larger database.


1 Like