Skip to main content

MoonGuard Filament Plugin release 1.0.9

· 2 min read
Alexis Fraudita

Since the last release of the MoonGuard Filament Plugin, we have been updating our tool to make it more useful for Laravel developers.

On this occasion, we realized within MoonGuard's internal Slack channel that we were not receiving notifications for exceptions from different team projects, and we were also receiving duplicate notifications for uptime and SSL-certificate.

In this post, we want to tell you how we solved these issues and what we learned.

Exception Notifications

For the exception notifications, we suspected that there might be an issue in the ExceptionLogGroupNotification class, which handles everything related to exception notifications in the MoonGuard Filament Plugin. We first reviewed the toSlack() method and realized that the route defined in getActionUrl() was incorrect, so everytime MoonGuard needed to send a Slack notification this method returned an error and blocked the entire process. This action url is the link to the exception detail view, so users can review the exception directly through one link.

getActionUrl.png

We updated the name of the route and the problem was solved. You can check more details in our Pull Request #75.

exceptionTest.png

Slack duplicate notifications

We realized that email notifications were being sent to every user registered as a Filament user. This means that in the case of Slack notifications, the same notification is also sent multiple times for the number of registered users.

sslCertificateTest.png

To address this, we reviewed the MoonGuard listeners that are executed every time an event occurs and realized that we were indeed using the UserRepository::all()  method, which sends the same notification to all users.

sslCertificateCheckFailedListener-class.png

To address this, we focused on sending the notification only to the Slack workspace instead of all users, creating a SlackNotifiable class inspired by the blog post from ralphjsmit (you can check more about how we created the object in this post). We updated the notifications to send them according to the channel, whether it's email (send to all users) or Slack (send only once). You can see the changes made in the Pull Request #76.

I hope this post has been useful for you. Remember to follow us on Twitter/X @moonguard_dev and join our Discord community for more information.