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

FIX: Approves user when redeeming an invite for invites only sites #16984

Merged
merged 1 commit into from Jun 3, 2022

Conversation

tgxworld
Copy link
Contributor

@tgxworld tgxworld commented Jun 3, 2022

When a site has SiteSetting.invite_only enabled, we create a
ReviewableUserrecord when activating a user if the user is not
approved. Therefore, we need to approve the user when redeeming an
invite.

There are some uncertainties surrounding why a ReviewableRecord is
created for a user in an invites only site but this commit does not seek
to address that.

Follow-up to 7c4e2d3

When a site has `SiteSetting.invite_only` enabled, we create a
`ReviewableUser`record when activating a user if the user is not
approved. Therefore, we need to approve the user when redeeming an
invite.

There are some uncertainties surrounding why a `ReviewableRecord` is
created for a user in an invites only site but this commit does not seek
to address that.

Follow-up to 7c4e2d3
@@ -79,7 +81,6 @@ def self.create_user_from_invite(email:, invite:, username: nil, name: nil, pass
authenticator.finish

if invite.emailed_status != Invite.emailed_status_types[:not_required] && email == invite.email && invite.email_token.present? && email_token == invite.email_token
user.email_tokens.create!(email: user.email, scope: EmailToken.scopes[:signup])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is unnecessary, see

email_token = self.email_tokens.create!(email: self.email, scope: EmailToken.scopes[:signup])
in User#activate which is called below.

Copy link
Contributor

@martin-brennan martin-brennan left a comment

Choose a reason for hiding this comment

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

Looks good, tested that it fixed the issue I was reproducing locally and it did 👍

@martin-brennan
Copy link
Contributor

@tgxworld there are failing specs but they don't seem related, around group ordering. Probably just flakes.

@tgxworld tgxworld merged commit 0fa0094 into discourse:main Jun 3, 2022
15 checks passed
@tgxworld tgxworld deleted the set_users_to_approve_invite_only branch June 3, 2022 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants