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

Avoid comparing domains when looking for an exact match of a local account #3336

Merged

Conversation

happycoloredbanana
Copy link
Contributor

This is supposed to fix #3064.

When looking for an exact account match, if the search string is in a user@domain form, check whether the domain is local before searching the accounts table.

@Gargron
Copy link
Member

Gargron commented May 26, 2017

This is supposed to fix #3064.

Does it work?

@happycoloredbanana
Copy link
Contributor Author

Yes. This is how I tested it:

Created a one-letter local account "i" and many remote accounts with the same letter in display_name. Tried /api/v1/accounts/search?q=i@mastodon.dev&limit=3 with curl and saw that only remote accounts are returned, although there's an exact match for the local account.
After the fix, it returns the exact match first and than - remote accounts.

@Gargron
Copy link
Member

Gargron commented May 26, 2017

Perhaps that could be a unit test with those exact actions?

@happycoloredbanana
Copy link
Contributor Author

Added a test.
Cannot figure out how Travis failures are even related.

@Gargron Gargron merged commit 9642601 into mastodon:master May 26, 2017
pso2club pushed a commit to pso2club/mastodon that referenced this pull request May 28, 2017
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.

account search API ignores specified instance when instance is local
2 participants