Skip to content

fix: can_be_replied_to() returns false for LiveLocation events.#6563

Merged
andybalaam merged 1 commit into
mainfrom
bma/fixCanBeRepliedTo
May 13, 2026
Merged

fix: can_be_replied_to() returns false for LiveLocation events.#6563
andybalaam merged 1 commit into
mainfrom
bma/fixCanBeRepliedTo

Conversation

@bmarty
Copy link
Copy Markdown
Contributor

@bmarty bmarty commented May 11, 2026

Let can_be_replied_to() returns false for LiveLocation events.

I do not really understand why self.content.is_message() return false for LiveLocation events, because when I read the code it should return true, but it's not the case.

If reviewer agrees with the change, I will spend time to add unit test and changelog.

Closes #6562

  • I've documented the public API Changes in the appropriate CHANGELOG.md files.
  • This PR was made with the help of AI.

Signed-off-by:

@bmarty bmarty requested a review from a team as a code owner May 11, 2026 14:52
@bmarty bmarty requested review from andybalaam and removed request for a team May 11, 2026 14:52
@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.95%. Comparing base (f503097) to head (4074ee8).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6563      +/-   ##
==========================================
+ Coverage   89.92%   89.95%   +0.03%     
==========================================
  Files         381      381              
  Lines      107620   107718      +98     
  Branches   107620   107718      +98     
==========================================
+ Hits        96778    96900     +122     
+ Misses       7170     7151      -19     
+ Partials     3672     3667       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 11, 2026

Merging this PR will not alter performance

✅ 50 untouched benchmarks


Comparing bma/fixCanBeRepliedTo (4074ee8) with main (f503097)

Open in CodSpeed

@andybalaam
Copy link
Copy Markdown
Member

If self.content.is_message() returns false, we don't need this change, right?

@bmarty
Copy link
Copy Markdown
Contributor Author

bmarty commented May 12, 2026

If self.content.is_message() returns false, we don't need this change, right?

No, because self.latest_json().is_some() is also returning true for LLS events.

@andybalaam
Copy link
Copy Markdown
Member

is_message checks the type is MsgLike but also checks that the MsgLikeKind is Message, not LiveLocation, so that is why it returns false for live locations.

    /// Check whether this item's content is a
    /// [`Message`][MsgLikeKind::Message].
    pub fn is_message(&self) -> bool {
        matches!(self, Self::MsgLike(MsgLikeContent { kind: MsgLikeKind::Message(_), .. }))
    }

@andybalaam
Copy link
Copy Markdown
Member

I think it is sensible to say that live location messages can't be replied to, and this looks like a reasonable way to do it.

Along with tests, I would like the comment to explain itself a little more. Maybe something like "Live location messages are not displayed on the timeline individually, so can't be replied to."

@bmarty
Copy link
Copy Markdown
Contributor Author

bmarty commented May 12, 2026

Thanks. I asked AI to add tests.

Copy link
Copy Markdown
Member

@andybalaam andybalaam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed the terrible test names your AI produced.

@andybalaam andybalaam force-pushed the bma/fixCanBeRepliedTo branch from 1899def to 4074ee8 Compare May 13, 2026 12:23
@andybalaam andybalaam enabled auto-merge (rebase) May 13, 2026 12:24
@andybalaam andybalaam merged commit c253114 into main May 13, 2026
53 of 55 checks passed
@andybalaam andybalaam deleted the bma/fixCanBeRepliedTo branch May 13, 2026 12:38
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.

[Task] EventTimelineItem.canBeRepliedTo should be false for Event of type org.matrix.msc3672.beacon_info

2 participants