-
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(mls-client): skip MLSClient registration if it has registered #2983
fix(mls-client): skip MLSClient registration if it has registered #2983
Conversation
Quality Gate passedIssues Measures |
Datadog ReportAll test runs ✅ 2 Total Test Services: 0 Failed, 2 Passed Test Services
|
@@ -214,13 +215,16 @@ class ClientDataSource( | |||
clientId: ClientId, | |||
publicKey: ByteArray, | |||
cipherSuite: CipherSuite | |||
): Either<CoreFailure, Unit> = | |||
): Either<CoreFailure, Unit> = if (clientRegistrationStorage.hasRegisteredMLSClient()) { |
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.
does clientRegistrationStorage.hasRegisteredMLSClient
take into account if the registered client still exists remotely, meaning if my app session expired and during that time the client was removed remotely, will this function still return true?
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.
That's another edge case, if the use was logged out without clearing the data, and delete the client from another device and afterwards tries to login on this device we can't detect it.
What we can do:
Currently if the client is registered, we get this error from the server API:
InvalidRequestError(errorResponse=ErrorResponse(code=400, message=MLS public key for the given signature scheme already exists, label=mls-duplicate-public-key))
We can instead of checking the local flag always try to register the client against the server, if we get that error then we ignore it.
Wdyt?
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.
For Proteus, we already check if the local client still exists remotely or not, I suggest MLS clients follow the same path as Proteus
Closing this: decided to go with another solution #2987 |
PR Submission Checklist for internal contributors
The PR Title
SQPIT-764
The PR Description
What's new in this PR?
Check if the MLS Client has registered, then skip the registration.
Issues
When the user logs out without clearing the data, we were trying to register the exist MLSClient again; that lead to an error!
Solutions
If the client has registered before and the user log in again to continue on a previously established session no need to register the client again and simply skip the api call.
Testing
Test Coverage (Optional)
How to Test
Have a user with MLS Enabled on their team
1- Log in and log out without clearing the data
2- When you try to log in again with the same use, you should be able to proceed successfully
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
.