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

Update grammar on Matrix Ids to be more spec compliant and render error instead of infinite loading in room member list screen #3206

Merged
merged 9 commits into from
Jul 17, 2024

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Jul 16, 2024

Content

Improve regex for Matrix ids.

Motivation and context

Less crash on debug build but more importantly improve pills detection.

Screenshots / GIFs

Tests

  • Included in the PR.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

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

@bmarty bmarty requested a review from a team as a code owner July 16, 2024 16:26
@bmarty bmarty requested review from ganfra and removed request for a team July 16, 2024 16:26
@bmarty bmarty added the PR-Bugfix For bug fix label Jul 16, 2024
Copy link
Contributor

github-actions bot commented Jul 16, 2024

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/LAkGgW

/**
* Tells if a string is a valid user Id.
*
* @param str the string to test
* @return true if the string is a valid user id
*/
fun isUserId(str: String?): Boolean {
return str != null && str matches PATTERN_CONTAIN_MATRIX_USER_IDENTIFIER
return str != null && str matches PATTERN_CONTAIN_MATRIX_USER_IDENTIFIER && str.length <= MAX_IDENTIFIER_LENGTH
Copy link

Choose a reason for hiding this comment

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

note (not necessarily something that needs to be fixed): max identifier length is defined in utf-8 bytes, but I think this is counting the number of chars

Copy link

codecov bot commented Jul 16, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 11 lines in your changes missing coverage. Please review.

Project coverage is 76.15%. Comparing base (f6bfe3c) to head (263c058).
Report is 3 commits behind head on develop.

Files Patch % Lines
...res/roomdetails/impl/members/RoomMemberListView.kt 72.50% 5 Missing and 6 partials ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3206   +/-   ##
========================================
  Coverage    76.14%   76.15%           
========================================
  Files         1644     1644           
  Lines        38759    38777   +18     
  Branches      7501     7512   +11     
========================================
+ Hits         29513    29529   +16     
- Misses        5350     5351    +1     
- Partials      3896     3897    +1     

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

@bmarty bmarty added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Jul 17, 2024
@github-actions github-actions bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Jul 17, 2024
@bmarty
Copy link
Member Author

bmarty commented Jul 17, 2024

Thanks for the remarks @tulir , I have pushed more commits.

Also the room member list will now display an error instead of an infinite loading when there is an error when loading the members:

Before Now
image image

(Note that this particular error will not occur anymore since the pattern for user Id now accept empty local part, and again, errors like this can only happen in debug build)

@bmarty bmarty changed the title Update grammar on Matrix Ids to be more spec compliant Update grammar on Matrix Ids to be more spec compliant and render error instead of infinite loading in room member list screen Jul 17, 2024
Copy link

sonarcloud bot commented Jul 17, 2024

@bmarty bmarty added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Jul 17, 2024
@bmarty bmarty enabled auto-merge July 17, 2024 16:05
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Jul 17, 2024
@bmarty bmarty merged commit 0ddc306 into develop Jul 17, 2024
32 checks passed
@bmarty bmarty deleted the feature/bma/updateGrammar branch July 17, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Bugfix For bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants