blomstra/test-notification-dispatcher

CLI to dispatch notifications for development/testing

0.1.0 2022-07-25 00:46 UTC

This package is auto-updated.

Last update: 2024-11-25 05:41:51 UTC


README

License Latest Stable Version Total Downloads

A Flarum extension. CLI to dispatch notifications for development/testing.

Run php flarum help testnotifications to get the list of available options.

This extension should probably never be executed in production. It deletes all the test user's web notifications and might have side effects on other user's notifications if the same event concerns multiple users.

The command works by finding events that have previously triggered the given notifications, and triggering the notifications again. It results in the web notifications being boosted back to the top and emails being sent again. The date of the notifications will be inaccurate as it will be reset to the current time.

If more events are found than the given limit (5 by default), then the events to trigger notifications for will pe picked at random.

The notifications are sent to the given test user which can be customized via command parameters. By default, the user with ID 1 will be used.

The following events/notifications are supported:

  • flarum/core: Discussion renamed (picks discussions authored by the test user that contain an event post for rename, no matter who renamed it)
  • flarum/suspend: User suspended (triggers once for the selected test user if they are suspended)
  • flarum/suspend: User unsuspended (triggers once for the selected test user if they are not suspended)
  • flarum/subscriptions: New post in followed discussion (will always use the last post of any discussion with one reply or more, even if all the replies are from the test user as well)
  • flarum/mentions: Post or user mention (any post not created by the test user nor a deleted user)
  • fof/follow-tags: New post in lurked tag (same constraints as posts in followed discussions)
  • fof/follow-tags: New discussion in followed or lurked tag (any discussion not created by the test user)

Installation

Install with composer:

composer require blomstra/test-notification-dispatcher:"*"

Updating

composer update blomstra/test-notification-dispatcher
php flarum migrate
php flarum cache:clear

Links