Alerts page mark read/viewed alerted inconsistent with alerts pop-up

Affected version
2.2.1

Xon

Well-known member
The alerts page call flow is;
PHP:
        $alertRepo->addContentToAlerts($alerts);
        $alerts = $alerts->filterViewable();

        $skipMarkRead = $this->filter('skip_mark_read', 'bool');
        if ($page == 1 && $visitor->alerts_unviewed && !$skipMarkRead)
        {
            $alertRepo->autoMarkUserAlertsRead($alerts, $visitor);
            $alertRepo->markUserAlertsViewed($visitor);

            $this->markInaccessibleAlertsReadIfNeeded($alerts);
        }

But alerts pop-up is;
PHP:
        $alertRepo->addContentToAlerts($alerts);

        $this->markInaccessibleAlertsReadIfNeeded($alerts);

        $alerts = $alerts->filterViewable();

        $alertRepo->autoMarkUserAlertsRead($alerts, $visitor);

        if ($visitor->alerts_unviewed)
        {
            $alertRepo->markUserAlertsViewed($visitor);
        }

What I see as issues;
  • markInaccessibleAlertsReadIfNeeded is called after $alerts->filterViewable(); and autoMarkUserAlertsRead.
    This makes markInaccessibleAlertsReadIfNeeded abort early as all alerts are viewable and $hasInaccessibleUnread will never be set
  • Mark-as-read logic is gated behind alerts_unviewed checks (ie has unviewed, page count, etc)
 
Top