Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Notification Channel Extender #2432

Merged
merged 15 commits into from
Nov 5, 2020

Conversation

SychO9
Copy link
Member

@SychO9 SychO9 commented Nov 1, 2020

Fixes #2419

Changes proposed in this pull request:

  • Use drivers for the different channels, each driver takes care of enqueing the notification job and adding the user preference.
  • Add an extender for adding new drivers.
  • Deprecate Flarum\Notification\Event\Sending Event.
  • Add some dockblocks for the notification extender.

Reviewers should focus on:

  • Are the drivers being properly registered.
  • Class/Interface/Method naming.

Confirmed

  • Backend changes: tests are green (run composer test).

Required changes:

src/Extend/Notification.php Outdated Show resolved Hide resolved
src/Extend/Notification.php Outdated Show resolved Hide resolved
src/Notification/Driver/NotificationDriverInterface.php Outdated Show resolved Hide resolved
src/Notification/Driver/NotificationDriverInterface.php Outdated Show resolved Hide resolved
src/Notification/Notification.php Outdated Show resolved Hide resolved
@askvortsov1
Copy link
Member

One interesting point brought up by flarum/pusher#28 is that each driver will end up queing its own, independent jobs. Do we want to split it up like this, or move the logic for running through the drivers to inside the event?

src/Extend/Notification.php Outdated Show resolved Hide resolved
Copy link
Member

@clarkwinkelmann clarkwinkelmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good code-wise.

I see the tests only test against the container bindings, not for the actual sending of notifications.

I'd love to see this tested with an actual use case, like the Telegram notifications of the Telegram login extension before being shipped, so we make sure we ship something that will be practical in the real world. Or was a test already performed on another real world extension?

@askvortsov1
Copy link
Member

Do you mean in the integration tests? If you mean manual testing, I'm planning to test this with my PWA extension before merging

@SychO9
Copy link
Member Author

SychO9 commented Nov 3, 2020

there's technically also the pusher extension which I tested on (if that counts).

Copy link
Member

@askvortsov1 askvortsov1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that this works with my PWA extension, for both preferences and actually sending notifications.

@askvortsov1 askvortsov1 merged commit f0e77a5 into flarum:master Nov 5, 2020
@SychO9 SychO9 deleted the sm/notification-channel-extender branch November 5, 2020 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Notification Channel Extender
4 participants