ISSUE-10: Implement comment subscription feature with event dispatching #45
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #10
This pull request introduces a new subscription feature to the comment system, allowing users to subscribe to commentable entities and receive notifications when new comments are posted. It adds support for managing subscriptions, dispatching distinct events for subscribers, and configuring notification behavior. The most important changes are grouped below.
Subscription Feature Implementation:
CommentSubscriptionmodel and corresponding migration to store subscriptions, enabling users to subscribe to any commentable entity. [1] [2]HasCommentstrait with methods to subscribe, unsubscribe, and retrieve subscribers for a commentable entity.Event Dispatching and Configuration:
UserIsSubscribedToCommentableEventevent and updated the comment creation logic to dispatch this event to subscribers, with configuration to optionally treat subscribers as mentions instead. [1] [2] [3]Testing and Migration Registration: