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.

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)
  • User Avatar
    0
    hole7 created

    Hi,

    As my little knowledge of abp -zero, it's already have a table for this stuff,

    SELECT * FROM [dbo].[AbpUserNotifications]

    You can use State column which has two values: 0 and 1 correspoding with UserNotificationSate enum of abp framework

    Thanks, Ho Le

  • User Avatar
    0
    hikalkan created
    Support Team

    Use IUserNotificationManager for it (<a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Notification-System#user-notification-manager">http://www.aspnetboilerplate.com/Pages/ ... on-manager</a>)