Unread notifications disappearing after 7 days
we've got an issue with our older, but still unread notifications. They are disappearing after 7 days without being read. I know that read notifications are supposed to disappear after that time. But I guess it's not supposed to happen for unread ones.
I've got one user who's got 50+ notifications after being on holiday for little over a week. I've been checking on his notifications and one after another they disappeared after turning older than 7 days. One time checking I saw two notifications that read "8 days ago". But now those are gone as well and the oldest ones all read "7 days ago".
Is this a known issue? And is there any way to retrieve those notifications? We're currently running NodeBB v1.11.1, I haven't gotten around upgrading to v1.11.2 yet.
Hi @AlexG this is intentional, actually, but I wasn't sure why so I took a little dive into the commit history.
It was added here: https://github.com/NodeBB/NodeBB/commit/26d9cc56d30c6a0a3c75cd427f04c71a67fb592a 5 (!!) years ago, the reason being that I wanted to limit database clutter.
You see, notifications are created and purposely aren't cleaned up immediately, as read notifications still have some utility. Additionally, when a notification is created, it can be pushed to multiple users, so even if it is read by one recipient, it could be unread for many other users.
Additionally, some users are inactive and may never read a notification, so would that notification linger around the database forever?
I'm not a fan of database bloat, and notifications had the potential to really litter the database. Therefore, after a week, notifications are removed, both read and unread.
The logic really hasn't changed at all since it was initially added. We can opt to make this configurable, with different limits on read notifications and unread notifications, but I firmly believe notification pruning is necessary.
thanks for your quick reply. It's really helpful for me to know that it is like that. And I completely understand why it was implemented. It seems I must have read some info wrong or it must have been old.
But that's actually quite a major issue for us and they way we're using NodeBB. It would be great if notification deletion could be made configurable. How are the chances of that beeing implemented? I don't know how much of an issue that is for other users of NodeBB.
Though I still need a short term solution for that. I need a way for a user to find all of his mentions when he hasn't been looged on for more than 7 days (but usually not more than a couple of weeks). Utilizing search won't really work, because it's not just about personal mentions, but also all of the groups the user is in. So that way would be rather inconvenient. The only possibility for me right now seems to be using email notifications. But maybe you've got another idea.
Thanks again for your help,
@julian is this approach also used to track read/unread posts (not only notifications)? We've experienced both on our nodeBB instance, as well as here, that the unread category only presents posts/thread that are no more that 1 week old.
Is it safe to change -7 in something more reasonable to us?
cutoff = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 7);
This is a must have here at Maxon.
You should be able to configure the unread cutoff in the ACP, https://github.com/NodeBB/NodeBB/blob/master/src/topics/unread.js#L50