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

Invite by email a new user failed (#479) #482

Merged
merged 3 commits into from
Mar 18, 2022
Merged

Invite by email a new user failed (#479) #482

merged 3 commits into from
Mar 18, 2022

Conversation

phloux
Copy link

@phloux phloux commented Mar 16, 2022

let identityService = MXIdentityService(identityServer: identityServerURL,
accessToken: nil,
accessToken: accessToken,
Copy link
Contributor

Choose a reason for hiding this comment

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

You could not provide this access token here

Copy link
Author

Choose a reason for hiding this comment

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

IdentityService instance has been removed here.

@@ -120,7 +111,7 @@ final class InviteService: InviteServiceType {
// Check whether a Tchap account has been created for this email. The closure returns a nil identifier when no account exists.
private func discoverUser(with email: String, completion: @escaping (MXResponse<InviteServiceDiscoverUserResult>) -> Void) {
let pid = MX3PID(medium: .email, address: email)
_ = self.identityService.lookup3PIDs([pid]) { response in
_ = self.session.identityService.lookup3PIDs([pid]) { response in
Copy link
Contributor

Choose a reason for hiding this comment

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

Your current implementation doesn't satisfy "The closure returns a nil identifier when no account exists."
We will sync about in direct

Copy link
Author

Choose a reason for hiding this comment

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

This is fixed in the last commit.

Copy link
Contributor

@giomfo giomfo left a comment

Choose a reason for hiding this comment

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

LGTM - test ok

@@ -120,12 +111,16 @@ final class InviteService: InviteServiceType {
// Check whether a Tchap account has been created for this email. The closure returns a nil identifier when no account exists.
private func discoverUser(with email: String, completion: @escaping (MXResponse<InviteServiceDiscoverUserResult>) -> Void) {
let pid = MX3PID(medium: .email, address: email)
_ = self.identityService.lookup3PIDs([pid]) { response in
guard let identityService = self.session.identityService else {
Copy link
Contributor

Choose a reason for hiding this comment

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

as a good practice, we would move the guard let as the first position of the block
(let pid... should be archived after the guard let)

Copy link
Author

Choose a reason for hiding this comment

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

I moved this on the last commit.

@phloux phloux merged commit 6d56050 into develop Mar 18, 2022
@phloux phloux deleted the phlpro/479 branch March 18, 2022 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants