-
Notifications
You must be signed in to change notification settings - Fork 249
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
Implemented the V1 notifications system with the corresponding unit t… #206
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @xu-ian,
Great work on implementing the functionality! However, I noticed a couple of issues:
1. Incorrect Date in Notifications: The date field populates “0” instead of “1.” Please check the logic and adjust it accordingly.
2. Notification Styling: The notification system design deviates from the proposed Figma design. Could you style it to align with the Figma design for consistency?
I’ve attached snapshots of the incorrect date issue and the Figma design for your reference:
• Incorrect Date Issue:
• Current notification system UI
Figma Design for Notification System:
… match Figma requirements.
Hey @poojithreddy28, I have fixed the issues you have brought up. Months now start at 1 instead of 0 and the styling has been adjusted. Here's a screenshot of the new styling: |
Hey @xu-ian , Thanks for addressing the issues! The updates look great, and I appreciate the fix for the months starting at 1. The styling adjustments also look much cleaner. Could you please also develop the notification icon to match the Figma design? Once that’s done, I’ll run everything on my local setup, test it out thoroughly, and will forward this senior devs for additional testing. Thanks again for your efforts! 😊 |
Hi @poojithreddy28, I have updated the notification icon to match the styling requirements. |
Great! I’ll conduct thorough testing on the changes and forward them to @yunusj if everything looks good. |
Hey @xu-ian , First off, a huge thank you for this contribution! 🎉 Your work on this PR is well-structured, neatly written, and includes comprehensive documentation and test cases, making it a breeze to review. I really appreciate the attention to detail and the effort you’ve put into this! After reviewing, here are a few areas where we can further optimize for performance, consistency, and scalability: 1. Optimize Notification Reads & Security
2. Firestore Structure Enhancement
3. Database Key Consistency
4. Folder Structure Suggestion
5. Automatic Cleanup of Old Notifications (Cost Optimization)
Next StepsIf you can incorporate these refinements, we’ll be in a great place to merge this PR. Let me know if you have any questions—I’d be happy to discuss or clarify any of the points above. Again, fantastic job! 👏 Contributions like these help Marvel AI grow, and we truly appreciate your effort 🚀. Looking forward to your updates! |
- Moved personal notifications to a subcollection under user. - Moved notification updating from backend to frontend and added security rules for accessing personal notifications. - Updated database keys to use camelCase isntead of snake_case - Updated folder structure for notification related triggers - Added a scheduled function that removes notifications older than 60 days once every day.
Hi @yunusj, I have made the requested changes in the new commit. The trigger that removes older notifications has a unit test that tests its' functionality, but not whether it runs at the requested interval, as the emulator does not support scheduled functions. |
Description
This PR is for the implementation of Epic 1.5, the V1 Notification System
Related Issue
If this PR addresses an issue, link to it here.
#201
Type of Change
Please select the type(s) of change that apply and delete those that do not.
Proposed Solution
New dependencies:
Updated Dependency:
Implementation reasonings
NotificationsButton.jsx (New)
This component displays a bell icon. On click this toggles the visibility of a list of Notifications.
NotificationList.jsx (New)
This component displays: A togglable all/unread button. A list of notifications relevant to the user. A button to read all notifications. This component is designed to be reused to display a list of notifications anywhere.
Notification.jsx (New)
This component displays: A single notification.
Firebase.jsx and FirebaseProviders.jsx (New)
These components are wrappers that configure reactfire to retrieve data from the configured firebase destination.
setReadStatus.js (New)
This function takes a message and updates the existing message in the database.
SideMenu.jsx (Updated)
Added the notification button to this Layout.
MainAppLayout/styles.js (Updated)
Updated the zIndex in the navigation bar, so the notifications appear above the contents of the page.
notificationController.js (New)
getNotifications: Takes a user id and an optional notification id and queries the personal-notifications collection. Returns a list of notifications that matches the query.
setNotificationStats: Takes a user id, an optional notification id, and a status. Queries the personal-notifications collection using user id and notification id and updates the is_read status of the query results with status.
onNewNotification: Trigger that occurs when a global notification is created. Creates a copy of the notification as a personal notification for every user.
onRemovedNotification: trigger that occurs when a global notification is removed. Removes every personal notification that was a copy of the global notification.
onNewTool: Trigger that occurs when a document is added to 'tools'. Creates a global notification that a new tool has been created.
onUpdatedTool: Trigger that occurs when a document is updated in 'tools'. Creates a global notification that a tool has been updated.
onNewAssistant: Trigger that occurs when a document is added to 'assistants'. Creates a global notification that a new assistant has been created.
onUpdatedAssistant: Trigger that occurs when a document is updated in 'assistants'. Creates a global notification that a assistant has been updated.
cloud_db_seed.js
How to Test
Notification System Demo Link on Loom
Unit Tests
Unit Tests are stored in __tests__. Emulator must be running in order for backend trigger tests to work. The backend trigger tests may not work sometimes due to delays due to unresponsiveness from the server.
__setup__/env-setup.js
jest.config.js
babel.config.js
NotificationsButton-test.js
NotificationList-test.js
NotificationTriggers-test.js
Documentation Updates
Indicate whether documentation needs to be updated due to this PR.
If yes, describe what documentation updates are needed and link to the relevant documentation.
Checklist
Additional Information
Add any other information that might be useful for the reviewers.