fix: fall back to m.mentions for USER_MENTION annotations#117
Closed
iFixRobots wants to merge 1 commit intomasterfrom
Closed
fix: fall back to m.mentions for USER_MENTION annotations#117iFixRobots wants to merge 1 commit intomasterfrom
iFixRobots wants to merge 1 commit intomasterfrom
Conversation
32c7abc to
54f7f55
Compare
…ION annotations When formatted_body is absent (e.g. Desktop client doesn't report FormattingFeature.UserLink), the bridge now reads MSC3952 m.mentions to construct USER_MENTION annotations from the plain text body. For each mentioned MXID: 1. Resolve to Google Chat ID via Puppet.get_id_from_mxid 2. Look up puppet display name via Puppet.get_by_gcid 3. Find @DisplayName offset in plain body text 4. Construct USER_MENTION annotation using existing GCEntity machinery Gracefully skips unresolvable MXIDs, missing puppets, and display names not found in the body text.
54f7f55 to
a0b13ba
Compare
Member
|
Unformatted mentions aren't valid. If room capabilities are inaccurate, then just need to fix the capabilities |
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.
Problem
When a Matrix client sends a message with
m.mentions(MSC3952) but noformatted_body, the bridge drops all mention annotations. Google Chat receives the message as plain text with noUSER_MENTION— the mentioned user gets no notification.This happens because the bridge only extracts mentions from HTML
<a href="matrix.to">pills informatted_body. Whenformat != HTML, it returns(body, None).The Beeper Desktop client hits this path because the Google Chat bridge does not report
FormattingFeature.UserLinkin room capabilities, causing the client to render mentions as<span>instead of<a>, which produces identical plain text forbodyandformattedBody, soformatted_bodyis omitted from the event.Fix
When
formatted_bodyis absent, check form.mentions.user_idsin the event content. For each mentioned MXID:Puppet.get_id_from_mxidPuppet.get_by_gcid@DisplayNameoffset in the plainbodytextUSER_MENTIONannotation using existingGCEntitymachineryGracefully skips unresolvable MXIDs, missing puppets, and display names not found in the body.
Fallback-only path — the existing HTML pill parsing is completely untouched.
Related