Skip to content

Conversation

@ricardogarim
Copy link
Contributor

@ricardogarim ricardogarim commented Oct 7, 2025

Proposed changes (including videos or screenshots)

As per FDR-182, quoted messages were not working for direct messages. The issue occurred because DMs have neither a name nor an fname, resulting in a null parameter being passed to the getMessageURLToReplyTo. Upon further analysis, there’s no need to pass roomName to the function, since only the rid is used to generate the quote messages links. Based on that, instead of adding a specific handler to check for DMs and pass an empty room name, I decided to remove the roomName parameter from the getMessageURLToReplyTo function altogether.

Issue(s)

Steps to test or reproduce

  1. Open a federated direct message (RC <-> RC or RC → Element).
  2. Quote a previous message.
  3. Send the quoted message.

Quoted messages should display correctly to the recipient, maintaining the original message content and formatting.

Further comments

Summary by CodeRabbit

  • Bug Fixes

    • Quoting and replying work reliably even when a room lacks a display name; links no longer break when room names are missing.
    • Improved robustness for federated or older rooms with incomplete metadata, reducing failures when replying to specific messages.
  • Improvements

    • Quote payloads now include richer original-message context to help preserve sender and server details.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Oct 7, 2025

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Oct 7, 2025

⚠️ No Changeset found

Latest commit: 82a86c5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ricardogarim ricardogarim force-pushed the fix/federation-quoted-dms branch from 17c7749 to db0537a Compare October 7, 2025 22:20
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 7, 2025

Walkthrough

Removes dependence on room.name when handling quotes in Matrix federation events, expands the edited-quote payload with rawMessage, homeServerDomain, and senderExternalId, and simplifies MeteorService.getMessageURLToReplyTo to accept (roomType, roomId, messageIdToReplyTo).

Changes

Cohort / File(s) Summary
Federation Matrix message handling
ee/packages/federation-matrix/src/events/message.ts
Stops gating quote processing on room.name; always processes when quoteMessageEventId exists. Calls MeteorService.getMessageURLToReplyTo without room.name. In edited-quote path, adds rawMessage, homeServerDomain, and senderExternalId to the toInternalQuoteMessageFormat payload.
Meteor service implementation
apps/meteor/server/services/meteor/service.ts
Changes getMessageURLToReplyTo signature to remove roomName and builds reply URLs without a room name parameter.
Meteor service type contract
packages/core-services/src/types/IMeteor.ts
Updates IMeteor.getMessageURLToReplyTo signature to (roomType: string, roomId: string, messageIdToReplyTo: string): Promise<string> (removes roomName parameter).

Sequence Diagram(s)

sequenceDiagram
  actor Matrix
  participant Handler as FederationMessageHandler
  participant Meteor as MeteorService

  Matrix->>Handler: incoming message event (may include quoteMessageEventId)
  alt quoteMessageEventId present
    Handler->>Handler: resolve originalMessage
    note right of Handler #CCF2FF: edited quote adds rawMessage,\nhomeServerDomain, senderExternalId
    Handler->>Meteor: getMessageURLToReplyTo(room.t, room._id, originalMessage._id)
    Meteor-->>Handler: messageURL
    Handler->>Handler: build quoted payload (incl. new fields if edited)
  else no quoteMessageEventId
    Handler->>Handler: normal processing
  end
  Handler-->>Matrix: persist/forward processed message
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • ggazzo
  • rodrigok

Poem

I’m a bunny in code, hopping through threads,
I stitch missing names where the reply URL treads.
Raw messages tucked in a carrot-lined stash,
Federated quotes now find their way back in a flash.
🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues Check ✅ Passed The pull request removes the roomName parameter and gating logic, updates the URL generation signature, and ensures quote handling works regardless of room.name, which satisfies the FDR-182 requirement to restore quoted message visibility in federated DMs.
Out of Scope Changes Check ✅ Passed All code changes are focused on quote handling and URL generation for federated messages and directly relate to the linked issue objectives, with no unrelated modifications detected.
Title Check ✅ Passed The title clearly describes the primary objective of the changeset—restoring the reception of quoted messages in federated direct messages—and aligns with the linked issue while remaining concise and free of extraneous details.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/federation-quoted-dms

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ricardogarim ricardogarim changed the base branch from develop to chore/fed-branded October 7, 2025 22:20
@ricardogarim ricardogarim marked this pull request as ready for review October 7, 2025 22:20
@ggazzo ggazzo force-pushed the chore/fed-branded branch 3 times, most recently from 6fc8f40 to 928973e Compare October 8, 2025 02:36
@ggazzo ggazzo requested review from a team as code owners October 8, 2025 02:36
@ggazzo ggazzo force-pushed the chore/fed-branded branch 5 times, most recently from 89ebe54 to 94445d8 Compare October 8, 2025 02:47
Base automatically changed from chore/fed-branded to release-7.11.0 October 8, 2025 03:42
@ggazzo ggazzo force-pushed the fix/federation-quoted-dms branch from db0537a to 1a1259c Compare October 8, 2025 03:47
@codecov
Copy link

codecov bot commented Oct 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.41%. Comparing base (3a85856) to head (82a86c5).
⚠️ Report is 4 commits behind head on release-7.11.0.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##           release-7.11.0   #37165      +/-   ##
==================================================
- Coverage           67.46%   67.41%   -0.06%     
==================================================
  Files                3329     3329              
  Lines              113381   113381              
  Branches            20579    20568      -11     
==================================================
- Hits                76490    76432      -58     
- Misses              34291    34352      +61     
+ Partials             2600     2597       -3     
Flag Coverage Δ
e2e 57.26% <ø> (-0.02%) ⬇️
unit 71.17% <ø> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ricardogarim ricardogarim marked this pull request as draft October 8, 2025 14:41
@ricardogarim ricardogarim force-pushed the fix/federation-quoted-dms branch from 1a1259c to 62f76cd Compare October 8, 2025 15:16
@ricardogarim ricardogarim force-pushed the fix/federation-quoted-dms branch from 62f76cd to 82a86c5 Compare October 8, 2025 15:29
@ricardogarim ricardogarim marked this pull request as ready for review October 8, 2025 15:34
@ggazzo ggazzo changed the title fix(federation): restore quoted messages reception regression(federation): restore quoted messages reception Oct 8, 2025
@ggazzo ggazzo merged commit 5ceef6f into release-7.11.0 Oct 8, 2025
51 checks passed
@ggazzo ggazzo deleted the fix/federation-quoted-dms branch October 8, 2025 22:39
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.

3 participants