MyBBStuff / MyAlerts

A simple notification/alert system for MyBB similar to IPB and XenForo's core implementations of user notifications.
http://www.euantor.com/myalerts/
47 stars 33 forks source link

Fix #312: Alerts count in title and header icon not updating #313

Closed lairdshaw closed 8 months ago

lairdshaw commented 11 months ago

...when an individual alert is marked read / deleted via the modal.

Resolves #312

Eldenroot commented 11 months ago

Good, thank you.

Eldenroot commented 11 months ago

OK, after some testing it is not working correctly in all cases. No alerts to display, but it shows (1). Before the applying this patch if was broken also in all cases, now it happens only sometimes.

image

lairdshaw commented 11 months ago

This can happen in the following scenario, which my guess is what applies here: another tab to the forum is open(ed), and in that other tab, an unread alert is deleted; in that scenario, the header icon of the original tab is not updated, because, currently, MyAlerts does not poll for updates to the header - its only polling (if enabled in its ACP settings) is to refresh the alerts listing on the alerts.php page itself.

Is it plausible that that's the scenario you've experienced here?

Eldenroot commented 11 months ago

Nope. It happens when you sometimes open a board... alert is not displayed

lairdshaw commented 11 months ago

Nope. It happens when you sometimes open a board... alert is not displayed

I can't see how this PR could be causing that. The new functionality that it implements is only called (via Javascript) when clicking in the modal on one of the delete/mark-read icons beside an individual alert. Simply opening a page and then opening the modal (without clicking on anything in the modal) shouldn't result in any of this new functionality being called.

If you can find a way to reproduce it, and let us know, that would be very helpful.

Eldenroot commented 10 months ago

Well, it happens only sometime.

All alerts are marked as read... counter shows "Alerts (0)"... but sometimes it shows "alerts (1)" but if you open the modal box or alert.phh in UCP there is no alerts... you have to click on mark all read or delete alerts to make it working... before this PR it was broken completely, this is a good step