feat(notifications): recipient-scoped delivery with mute and block preferences#404
Open
Varshinibhargav-17 wants to merge 1 commit into
Open
Conversation
…te/block preferences
- Scope notifications to recipient using notifications/{uid}/userNotifications subcollection
- Add recipient_uid field to notification documents
- Fix getNotificationData to fetch only current user's notifications
- Check notification_preferences before creating notification (skip if sender is blocked)
- Add blockUser action — writes to notification_preferences/{uid}.blockedUsers
- Add muteUser action — writes to notification_preferences/{uid}.mutedUsers
- Update readNotification and deleteNotification to use subcollection path
- Add BLOCK_USER, MUTE_USER, GET_BLOCKED_USERS action types
- Update dataReducer to handle blockedUsers and mutedUsers state
- Wire up Block and Mute buttons in NotificationBox.jsx
Fixes c2siorg#359
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Implements recipient-scoped notifications with mute/block preferences,
fixing the architectural issues described in #359.
Problem
The existing notification system stored all notifications in a shared
flat collection with no recipient scoping. getNotificationData fetched
ALL notifications globally, read/delete operations used the flat
collection path, and the Block user UI button in NotificationBox.jsx
had no implementation.
Changes Made
Firestore structure:
Notifications are now stored at notifications/{uid}/userNotifications/{notification_id}
— one subcollection per user, fully recipient-scoped.
addNotification:
notification — skips delivery if sender is blocked
getNotificationData:
global fetch
readNotification / deleteNotification:
blockUser action (new):
via arrayUnion
muteUser action (new):
via arrayUnion
NotificationBox.jsx:
dataReducer.js:
actionTypes.js:
Testing
Fixes #359