Make sure to re-sort the filtered repositories in search
The filtering breaks the ordered we expected, so we need to re-sort
This commit is contained in:
parent
105acbc041
commit
9d97e053b3
1 changed files with 7 additions and 1 deletions
|
@ -464,7 +464,13 @@ def _filter_repositories_visible_to_username(unfiltered_query, filter_username,
|
||||||
.where(Repository.id << list(new_unfiltered_ids)))
|
.where(Repository.id << list(new_unfiltered_ids)))
|
||||||
|
|
||||||
filtered = _basequery.filter_to_repos_for_user(query, filter_username, repo_kind=repo_kind)
|
filtered = _basequery.filter_to_repos_for_user(query, filter_username, repo_kind=repo_kind)
|
||||||
for filtered_repo in filtered:
|
|
||||||
|
# Sort the filtered repositories by their initial order.
|
||||||
|
all_filtered_repos = list(filtered)
|
||||||
|
all_filtered_repos.sort(key=lambda repo: found_ids.index(repo.id))
|
||||||
|
|
||||||
|
# Yield the repositories in sorted order.
|
||||||
|
for filtered_repo in all_filtered_repos:
|
||||||
yield filtered_repo
|
yield filtered_repo
|
||||||
|
|
||||||
# If the number of found IDs is less than the chunk count, then we're done.
|
# If the number of found IDs is less than the chunk count, then we're done.
|
||||||
|
|
Reference in a new issue