Skip to content
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

Prevent crash with duplicate room suggestion #3576

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

frebib
Copy link
Contributor

@frebib frebib commented Oct 1, 2024

Content

If two rooms have the same canonical alias, e.g. the recently tombstoned and upgraded #foundation-office:matrix.org, typing #foun into the composer could cause the app to crash. This avoids that by using the (hopefully) globally unique room id as the key instead.

Motivation and context

Screenshots / GIFs

Tests

  • Step 1: Join #element-x-android:matrix.org and #definitely-matrix-hq:maunium.net, both of which have the canonical alias #element-x-android:matrix.org
  • Step 2: Type #ele into the composer and watch the app crash

With this patch, the app does not crash
1000006130

Tested devices

  • Physical
  • Emulator
  • OS version(s): Whatever Pixel 8 runs

Checklist

  • Changes have been tested on an Android device or Android emulator with API 23
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • Pull request includes a sign off
  • You've made a self review of your PR

@frebib frebib requested a review from a team as a code owner October 1, 2024 21:05
@frebib frebib requested review from ganfra and removed request for a team October 1, 2024 21:05
Copy link
Contributor

github-actions bot commented Oct 1, 2024

Thank you for your contribution! Here are a few things to check in the PR to ensure it's reviewed as quickly as possible:

  • Your branch should be based on origin/develop, at least when it was created.
  • The title of the PR will be used for release notes, so it needs to describe the change visible to the user.
  • The test pass locally running ./gradlew test.
  • The code quality check suite pass locally running ./gradlew runQualityChecks.
  • If you modified anything related to the UI, including previews, you'll have to run the Record screenshots GH action in your forked repo: that will generate compatible new screenshots. However, given Github Actions limitations, it will prevent the CI from running temporarily, until you upload a new commit after that one. To do so, just pull the latest changes and push an empty commit.

Copy link

codecov bot commented Oct 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.69%. Comparing base (f344a12) to head (7f3ebbb).
Report is 4 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3576      +/-   ##
===========================================
- Coverage    82.70%   82.69%   -0.01%     
===========================================
  Files         1732     1732              
  Lines        40982    40982              
  Branches      4964     4964              
===========================================
- Hits         33894    33890       -4     
- Misses        5333     5334       +1     
- Partials      1755     1758       +3     

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

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!
Worth noting that to observe the crash, user need to enable room suggestions in the developer settings, since we do not want to enable the feature if EXI does not support it.

If two rooms have the same canonical alias, e.g. the recently tombstoned
and upgraded #foundation-office:matrix.org, typing `#foun` into the
composer could cause the app to crash. This avoids that by using the
(hopefully) globally unique room id as the key instead.

Signed-off-by: Joe Groocock <me@frebib.net>
@bmarty bmarty merged commit ee7e5b8 into element-hq:develop Oct 2, 2024
21 of 22 checks passed
@frebib frebib deleted the frebib/dupe-room-crash branch October 2, 2024 12:09
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.

2 participants