-
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: 1:1s end up at the bottom of the list after migration [WPB-15452] #3232
fix: 1:1s end up at the bottom of the list after migration [WPB-15452] #3232
Conversation
…pdate-last-modified-date-when-migrating-1on1
Quality Gate passedIssues Measures |
Test Results3 405 tests +2 3 297 ✅ +2 5m 51s ⏱️ +32s Results for commit 94d3e5d. ± Comparison against base commit 7611f05. This pull request removes 1 and adds 3 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
).map { | ||
// Emit most recent last modified date of the proteus conversations to pass it to the target conversation | ||
conversationRepository.getConversationById(proteusOneOnOneConversation).getOrNull()?.lastModifiedDate.let { | ||
listOfNotNull(lastModifiedDate, it).maxOrNull() | ||
} | ||
} | ||
}.map { lastModifiedDate -> | ||
// Fallback to current time if not found as it means that it's completely new conversation without any history | ||
lastModifiedDate ?: currentInstant() | ||
} | ||
}.flatMap { lastModifiedDate -> | ||
conversationRepository.updateConversationModifiedDate(targetConversation, lastModifiedDate) |
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.
you can do the same in the query that does the update to avoid updating
kalium/persistence/src/commonMain/db_user/com/wire/kalium/persistence/Messages.sq
Line 582 in d54cc28
moveMessages: |
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.
not sure whether moveMessages
query should have any side effects and we don't update it for every message type so we would need to duplicate the logic from persistMessage
and MessageContent.shouldUpdateConversationOrder()
into sql, also, I think it would be harder to set current time as iso string directly in sql 🤔
Bencher Report
Click to view all benchmark results
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3232 +/- ##
===========================================
- Coverage 54.47% 54.45% -0.03%
===========================================
Files 1269 1269
Lines 36964 36971 +7
Branches 3745 3747 +2
===========================================
- Hits 20137 20132 -5
- Misses 15414 15426 +12
Partials 1413 1413
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Datadog ReportBranch report: ✅ 0 Failed, 3297 Passed, 108 Skipped, 1m 1.84s Total Time |
PR Submission Checklist for internal contributors
The PR Title
SQPIT-764
The PR Description
What's new in this PR?
Issues
1:1 conversations, after MLS migration, are moved to the bottom of the conversation list, even if the conversation has some messages sent or received in the meantime.
Causes (Optional)
This is due to the fact that when migrating 1:1, a new conversation with different id is created, so in theory this new one doesn’t have any events thus
lastEventTime
andlast_modified_date
are empty (01.01.1970) - that’s why it’s moved to the bottom of the list as the query. It creates confusion and inconsistency in sorting as now, even if a conversation had some messages, which are migrated to the new one.Solutions
Update
last_modified_date
when migrating history (messages) - take the value from previous proteus conversation or set a current time otherwise (if there's no previous proteus conversation then it means it's a completely new one so it should be at the top anyway).Testing
Test Coverage (Optional)
How to Test
Have proteus 1:1, send and receive some messages, migrate to MLS, check whether the conversation is still on the proper position on a list.
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
.