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

Only check locally when deduplicating usernames #13581

Merged
merged 1 commit into from
Apr 30, 2020
Merged

Only check locally when deduplicating usernames #13581

merged 1 commit into from
Apr 30, 2020

Conversation

kaiyou
Copy link
Contributor

@kaiyou kaiyou commented Apr 30, 2020

When deduplicating account usernames for OAuthable users, the routine did check if any account was known with that username, including remote accounts. This caused some unnecessary deduplication, and usernames ending with unexpected trailing _1.

This fixes #13580

When deduplicating account usernames for OAuthable users, the routine did check if any account was known with that username, including remote accounts. This caused some unnecessary deduplication, and usernames ending with unexpected trailing _1.
This fixes #13580
Copy link
Contributor

@ClearlyClaire ClearlyClaire 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 to me, thanks!

@@ -82,7 +82,7 @@ def ensure_unique_username(starting_username)
username = starting_username
i = 0

while Account.exists?(username: username)
while Account.exists?(username: username, domain: nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: I would use Account.local.exists?(...) but this is fine.

@Gargron Gargron merged commit 3511528 into mastodon:master Apr 30, 2020
@kaiyou kaiyou deleted the patch-1 branch April 30, 2020 12:49
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.

Accounts created through Omniauth are sometimes wrongly de-duplicated (_1 added)
3 participants