Skip to content

Conversation

@navneetrai
Copy link
Member

Fixes #28

This pull request adds a built-in, opt-in notification system for user mentions in comments. It introduces configuration options to enable or disable notifications, specify delivery channels, and customize notification behavior. The notification system is extensible, allowing developers to override the default notification class and define custom URL resolvers for comment links. Comprehensive tests are included to validate the notification logic and configuration options.

Opt-in Mention Notifications

  • Added a new notifications configuration section in config/commentions.php to enable mention notifications, select channels (mail, database, etc.), customize mail subject, and override listener/notification classes.
  • Registered the SendUserMentionedNotification listener for the UserWasMentionedEvent in the service provider, conditional on configuration.

Notification Delivery and Extensibility

  • Implemented SendUserMentionedNotification listener (src/Listeners/SendUserMentionedNotification.php) to send notifications to mentioned users via the configured channels, with support for custom notification classes.
  • Created the UserMentionedInComment notification class (src/Notifications/UserMentionedInComment.php) supporting mail, database, and broadcast delivery, and utilizing a configurable comment URL resolver.
  • Added comment URL resolver logic to Config (src/Config.php), allowing custom URLs in notifications.

Documentation and Testing

  • Updated README.md to document the opt-in notification feature, configuration, and usage of the URL resolver. [1] [2]
  • Added extensive tests for mention notification delivery, custom notification overrides, disabling notifications, empty channels, and URL resolver behavior (tests/Notifications/MentionNotificationTest.php).

@navneetrai navneetrai requested a review from luisdalmolin August 9, 2025 15:51
@navneetrai navneetrai self-assigned this Aug 9, 2025
@navneetrai navneetrai changed the title Implement opt-in notifications for user mentions in comments ISSUE-28: Implement opt-in notifications for user mentions in comments Aug 11, 2025
@navneetrai navneetrai force-pushed the issue-28-event-notification branch from acfc54b to 84d6e1d Compare September 9, 2025 15:46
@navneetrai navneetrai merged commit 059b7d6 into main Sep 9, 2025
2 of 6 checks passed
@navneetrai navneetrai deleted the issue-28-event-notification branch September 9, 2025 16:18
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.

Opt-in automatic notifications for mentioned users

3 participants