-
Notifications
You must be signed in to change notification settings - Fork 19
chore: enhance message service with reply handling and deprecate old methods #273
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Always emit
rel_type: 'm.thread'for thread repliesWhen
reply.showInMainChatis true we currently droprel_type, leaving onlyis_falling_back/event_id. Matrix clients (and remote homeservers) then treat the event as a plain reply, so thread context is lost—precisely the regression we are fixing for FDR-228. The spec requiresrel_type: "m.thread"regardless of fallback, even when the event should appear in the main timeline.Please keep
rel_typefor all thread variants (and letshowInMainChatdrive onlyis_falling_back). A minimal fix:return { 'm.relates_to': { - ...(!reply.showInMainChat && { rel_type: 'm.thread' as const }), - is_falling_back: false, + rel_type: 'm.thread' as const, + is_falling_back: reply.showInMainChat ?? false, event_id: reply.threadEventId, 'm.in_reply_to': { event_id: reply.replyToEventId }, }, } as const;and similarly ensure the second branch keeps
rel_type: 'm.thread'while defaultingis_falling_backtoreply.showInMainChat ?? true. This preserves thread metadata for both local and federated consumers.📝 Committable suggestion
🤖 Prompt for AI Agents
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.
hm, its a bit different that I read here:
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.
🧩 Analysis chain
🌐 Web query:
💡 Result:
Short answer: rel_type "m.thread" marks an event as belonging to a thread (event_id = thread root). Whether a threaded event is also shown in the room’s main timeline is controlled by the reply/fallback fields — not a separate "showInMainChat" flag. Concretely:
References:
If you want, I can fetch the exact MSC excerpt and show the JSON examples (with is_falling_back cases).
@ggazzo, you're absolutely right, and I apologize for the incorrect suggestion!
The Matrix spec is clear: omitting
rel_type: "m.thread"while still referencing the thread root is the correct way to make a message appear in the main timeline. The current implementation is correct:showInMainChat: true→ omitsrel_type→ message appears in main timeline (as a rich reply to the thread root)showInMainChat: false→ includesrel_type: "m.thread"→ message appears only in thread timelineFor FDR-228 (the file upload issue), the fix should ensure that when files are uploaded inside a thread, they're sent with
rel_type: "m.thread"so they appear in the thread timeline on remote homeservers, not the main room timeline. The current code correctly handles this whenshowInMainChatis false or not specified.Thank you for catching this!
✏️ Learnings added
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.
no problem :)
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.
@ggazzo, thank you for your patience and for the clarification! 🙏 If you need anything else, feel free to reach out.
🧠 Learnings used