Fixed XF\Api\Controller\Alert :: assertViewableAlert has two coding errors

DragonByte Tech

Well-known member
Affected version
2.2.1
This block of code:
PHP:
        if ($alert->alerted_user_id != \XF::visitor()->user_id)
        {
            throw $this->notFound();
        }

        if (!$alert->canView())
        {
            throw $this->noPermission();
        }

Produces hard errors when viewed in phpStorm:

1603746862872.webp


1603746879910.webp

From what I can tell, phpStorm is accurate in its analysis. I believe both notFound and noPermission should be surrounded by $this->exception().
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.2).

Change log:
Throw exceptions correctly in the alert API controller.
There may be a delay before changes are rolled out to the XenForo Community.
 
Top Bottom