mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-28 02:50:38 +00:00
Case insensitive remote user search
This commit is contained in:
parent
33c97e38a9
commit
0de1b8d0c3
3 changed files with 5 additions and 2 deletions
|
@ -112,6 +112,9 @@ class ViewsHelpers(TestCase):
|
|||
result = views.helpers.handle_remote_webfinger("mouse@local.com")
|
||||
self.assertEqual(result, self.local_user)
|
||||
|
||||
result = views.helpers.handle_remote_webfinger("mOuSe@loCal.cOm")
|
||||
self.assertEqual(result, self.local_user)
|
||||
|
||||
@responses.activate
|
||||
def test_load_user(self, _):
|
||||
""" find a remote user using webfinger """
|
||||
|
|
|
@ -124,7 +124,7 @@ def handle_remote_webfinger(query):
|
|||
return None
|
||||
|
||||
try:
|
||||
user = models.User.objects.get(username=query)
|
||||
user = models.User.objects.get(username__iexact=query)
|
||||
except models.User.DoesNotExist:
|
||||
url = "https://%s/.well-known/webfinger?resource=acct:%s" % (domain, query)
|
||||
try:
|
||||
|
|
|
@ -34,7 +34,7 @@ class Search(View):
|
|||
if query and re.match(regex.full_username, query):
|
||||
handle_remote_webfinger(query)
|
||||
|
||||
# do a user search
|
||||
# do a user search
|
||||
user_results = (
|
||||
models.User.viewer_aware_objects(request.user)
|
||||
.annotate(
|
||||
|
|
Loading…
Reference in a new issue