Merge pull request #1037 from bookwyrm-social/search-bug

Fixes error on empty search results
This commit is contained in:
Mouse Reeve 2021-05-03 10:57:53 -07:00 committed by GitHub
commit 7db8e249cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -127,7 +127,7 @@ class Views(TestCase):
response = view(request)
response.render()
self.assertEqual(response.context_data["results"].object_list.count(), 0)
self.assertFalse("results" in response.context_data)
def test_search_lists(self):
"""searches remote connectors"""

View file

@ -56,6 +56,7 @@ class Search(View):
results = endpoints[search_type](
query, request.user, min_confidence, search_remote
)
if results:
paginated = Paginator(results, PAGE_LENGTH).get_page(
request.GET.get("page")
)