-
Notifications
You must be signed in to change notification settings - Fork 171
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
Conversation
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
...es/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/core/MatrixPatterns.kt
Outdated
Show resolved
Hide resolved
...es/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/core/MatrixPatterns.kt
Outdated
Show resolved
Hide resolved
/** | ||
* 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 |
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.
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 char
s
Codecov ReportAttention: Patch coverage is
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. |
…ld (will fix crash on debug build).
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:
(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) |
Quality Gate passedIssues Measures |
Content
Improve regex for Matrix ids.
Motivation and context
Less crash on debug build but more importantly improve pills detection.
Screenshots / GIFs
Tests
Tested devices
Checklist