[AddonsLab] Unread Post Count

xF2 Add-on [AddonsLab] Unread Post Count 1.6.0

No permission to download
The package optimizes the query for fetching unread posts as recommended by @XFA

As we already fetch the nodes in a separate query, no additional query was required.

Thank you!
This release resolves an issue with the expired cache not being rebuilt on the fly. Now the expired cache is updated immediately when a user visits the board after a long time of inactivity.
The release implements support for node permissions View threads by others and View thread content. Users not having these permissions for a particular node will not see the posts in that node as unread.

In this release, we have also solved the issue with the unread counter being empty on the first page load due to a missing cache.

The release has breaking changes in its code, so if you are using the product in any way other than the officially suggested callback AL\UnreadPostCount\Callback::getUnreadPostCount, please review your custom code using the service CounterService.
Due to migration to a new caching strategy, a bug was introduced that would not change unread post count badge when the user reads an unread post.

Please note, that the product has an option Unread Post Count Cache (Minutes) in the option group Threads, discussions and conversations which defines how long unread post counts should be cached. If caching is not desired, and you want your users to always immediately see the number of unread posts, just set this option to 0. Caching is highly recommended for large websites, for at least as short as 1 minute, as executing an aggregation query on each page load may increase server load considerably.
This release fixes a bug that caused the unread post count badge not to be shown immediately after login. The issue was caused by storing cached information in the session which would reset with every logout/login. Now the cache is stored in the registry and is rebuilt only once per user and when the cache expires for the given user.
The release changes the way unread post count is loaded from the database, delaying the query till the page is fully generated and sent to users. Because of it users will see the out-of-date count for one more page load, but on the next load, they will see the updated data, without any effect on the speed of generation of the data. Just as before, the query does not happen on every page, but only when the cache is out of date.

This will also resolve the cases when MySQL error might be thrown if add-on callback is called while a query is in progress, trigger error

MySQL fetch error [2014]: Commands out of sync
The release fixes an issue causing many SQL queries when the number of unread posts is rebuilt for the user, particularly reproduced when using Tapatalk, but may affect other cases as well.
In this release, we have solved a compatibility issue with PixelExit styles (and possibly other custom themes that put the link to unread messages in mobile view in a separate macro).
in this release we have added an option in the product to show the number of unread posts in mobile view. The option is enabled by default. Here are screenshots showing the options of the product and the counter in mobile view:


In this version, we have implemented a new phrase that controls the badge added. Phrase ID is "unread_post_counter" and by default, it only contains the counter variable, so after installation, the default behavior of the product does not change. However, the phrase can be edited to include any custom text or to remove the counter and replace with a phrase, like "New!".