feat(messages): add message forwarding supportFeat/add message forwarding support#131
feat(messages): add message forwarding supportFeat/add message forwarding support#131nihar-ux18 wants to merge 10 commits into
Conversation
|
@nihar-ux18 is attempting to deploy a commit to the Akash Santra 's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Warning Review limit reached
Next review available in: 52 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughMessage forwarding adds persisted lineage fields, a protected backend endpoint with user/group delivery events, and frontend recipient selection with forwarded-message indicators. ChangesMessage forwarding
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant MessageBubble
participant ForwardModal
participant forwardMessage
participant Message
participant SocketIO
User->>MessageBubble: Select Forward
MessageBubble->>ForwardModal: Open with messageId and recipients
User->>ForwardModal: Select users or groups
ForwardModal->>forwardMessage: POST /messages/forward
forwardMessage->>Message: Load original and create forwarded copies
forwardMessage->>SocketIO: Emit recipient delivery events
forwardMessage-->>ForwardModal: Return created messages
ForwardModal-->>User: Show success or error toast
Possibly related issues
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@backend/.env.example`:
- Line 2: Replace the live MongoDB connection string in the environment example
with a generic placeholder containing no real username, password, or host
credentials, and rotate or revoke the exposed Atlas database secret through the
appropriate secret-management path.
In `@backend/src/controllers/message.controller.js`:
- Around line 367-418: Update the forwarding flow around originalMessage and the
destinations loop to authorize the requester before processing content: require
senderId to be the original sender or receiver, or a member of
originalMessage.groupId, and reject unauthorized access without exposing the
message. For each groupId destination, verify senderId membership using the same
isMember guard or established group-membership mechanism as sendGroupMessage
before Message.create or socket emission; preserve valid user-destination
forwarding.
- Around line 363-378: Validate messageId and destinations at the start of the
forwarding handler, before calling Message.findById or iterating destinations.
Require a valid messageId format and require destinations to be an array; return
a 400 response for either invalid input, following the validation pattern used
by sendMessage and sendGroupMessage. Preserve the existing forwarding flow for
valid requests.
In `@frontend/src/components/MessageBubble.jsx`:
- Around line 301-323: Remove the `${message.isForwarded && (...)}` JSX block
from the bubble `className` template in `MessageBubble`, leaving only valid
class-string interpolations. Remove the stray `ƒ` prefix from the non-sender
background class, and retain the existing Forwarded badge rendering around the
later badge block.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 547c1412-61c0-4903-85e9-e655e469eee2
📒 Files selected for processing (6)
backend/.env.examplebackend/src/controllers/message.controller.jsbackend/src/models/message.model.jsbackend/src/routes/message.route.jsfrontend/src/components/ForwardModal.jsxfrontend/src/components/MessageBubble.jsx
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@backend/src/controllers/message.controller.js`:
- Around line 391-395: Update both group-membership checks in sendGroupMessage
at backend/src/controllers/message.controller.js lines 391-395 and 416-420 to
compare member.userId.toString() with senderId.toString(), ensuring
authorization works for embedded member documents.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 93d78b73-cf2d-4524-a04a-2943d67c0b65
📒 Files selected for processing (3)
backend/.env.examplebackend/src/controllers/message.controller.jsfrontend/src/components/MessageBubble.jsx
🚧 Files skipped from review as they are similar to previous changes (1)
- frontend/src/components/MessageBubble.jsx
|
Hi @Akash504-ai, I've completed the implementation for #116 (Add Message Forwarding Support) and addressed the review feedback. Could you please take a look and let me know if any further changes are needed? Thanks! |
|
Thanks! I'll take a look when I get some time and let you know if there's any feedback. Appreciate it. |
Summary
This PR adds support for forwarding messages across private and group conversations.
Changes
isForwardedoriginalMessageIdSupported Forwarding
Testing
And I have attached a screen recording of working of the forward feature.
Screen.Recording.2026-07-24.at.12.03.22.mov
Summary by CodeRabbit