Base solution for your next web application
Open Closed

Tracking which notifications have been read? #961


User avatar
0
apexdodge created

I was wondering if anyone had a best practice for tracking which notifications have been read.

Let's assume you have a bubble at the top with the number of unread notifications, like on Facebook.
image

Currently ABP supports subscribe / publish. But I can't find anywhere automatically built in for tracking which notifications have been read and which haven't.

Anyone do this with ABP's notification framework yet?

I'm thinking I add my own table ReadNotifications with the following columns:

Id
UserId
NotificationsId
CreationTime

Then I only add a row to this table once a notification has been read for this user. If a notification Id along with the user Id does not appear in this table, then you can assume it was not read.

I feel like that is not the best way though? Is it a table scan every time you need to check if each notification was read or not? Could get really slow.

My other idea to add a column to the AbpUsers table:

UnreadNotificationsIds

Then comma separate the notification ids that have not been read there. But I feel this is also not clean? This would be faster than the first approach probably.

Looking for your thoughts.

Thanks!


2 Answer(s)