Getting the amount of unread notifications is a very difficult problem that Mastodon and Pleroma both handled very poorly
-
Getting the amount of unread notifications is a very difficult problem that Mastodon and Pleroma both handled very poorly
First of all, Mastodon didn't even have a good way to do it through the API until a few months ago. And they decided to make that API poorly. The way the unread count is handled is through a marker that contains the ID of the last read notification, which is all good, but the marker and the unread count are gotten through different endpoints. This means that if an app both wants to know the amount of unread notifications and what the last read is (i.e. to highlight unread notifications), two API requests are needed and it can't be displayed on the screen before both have finished. Oh and you of course also have to handle if one is successful but the other is not for whatever reason
And then there is Pleroma that in a way has the opposite problem. They did implement a way to get the unread count from the same API endpoint as the marker already in 2020, which is great, but the problem here is that the marker and the unread count aren't saved from the same endpoint. The client of course has to tell the server which notifications have been read, and saving the marker is done from the Mastodon endpoint, but setting the seen property on notifications that the unread counter uses is done through a specific mark as read endpoint in the Pleroma API, so here there are again two requests to manage -
Copyright © 2024 NodeBB | Contributors