-
Notifications
You must be signed in to change notification settings - Fork 6
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
fix: crash when self user is mentioned multiple times in last message [WPB-15157] #3192
base: release/android-cycle-4.9
Are you sure you want to change the base?
fix: crash when self user is mentioned multiple times in last message [WPB-15157] #3192
Conversation
Quality Gate passedIssues Measures |
Test Results3 272 tests 3 165 ✅ 4m 42s ⏱️ Results for commit 3870c25. ♻️ This comment has been updated with latest results. |
Datadog ReportBranch report: ✅ 0 Failed, 3165 Passed, 107 Skipped, 33.6s Total Time |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## release/android-cycle-4.9 #3192 +/- ##
============================================================
Coverage ? 52.67%
============================================================
Files ? 1323
Lines ? 51749
Branches ? 4804
============================================================
Hits ? 27257
Misses ? 22526
Partials ? 1966 Continue to review full report in Codecov by Sentry.
|
PR Submission Checklist for internal contributors
The PR Title
SQPIT-764
The PR Description
What's new in this PR?
Issues
When self user receives a message in which he/she is mentioned more than once, the app crashes as long as this message is the last one for the given conversation:
java.lang.IllegalArgumentException: Key "[email protected]" was already used
Causes (Optional)
When making a query, we left-join
MessageMention
with self_user_id or null if there are no mentions in last message for self user, however, this table has primary key consisting of not onlymessage_id
andconversation_id
which means that there can be more than one mention in a given last message, moreover - self user can be mentioned more than once and that's what happens - self user has two mentions in last conversation message and then left-join creates two rows for the given conversation with both mentions.Solutions
Count self user mentions and group results by
conversation_id
so that we're sure that there will only be a single row for each conversation.When I was analysing and making tests of different approaches to find optimal one back then (#3098) I also noticed that having
group by conversation_id
doesn't affect the execution time, so it should be safe to use that.PR Post Submission Checklist for internal contributors (Optional)
PR Post Merge Checklist for internal contributors
References
feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764
.