Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
return add-ons matching any platform when "All Systems" is selected (…
Browse files Browse the repository at this point in the history
…bug 752023)
  • Loading branch information
cvan committed May 7, 2012
1 parent 6b63c87 commit 2983071
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions apps/search/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,12 @@ def test_results_respect_appver_filtering_for_non_extensions(self):
eq_(self.get_results(r),
sorted(self.addons.values_list('id', flat=True)))

def test_results_platform_filter_all(self):
for platform in ('', 'all'):
r = self.client.get(self.url, dict(platform=platform))
eq_(self.get_results(r),
sorted(self.addons.values_list('id', flat=True)))


class TestPersonaSearch(SearchBase):
fixtures = ['base/apps']
Expand Down
4 changes: 3 additions & 1 deletion apps/search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,9 @@ def _filter_search(request, qs, query, filters, sorting,
qs = qs.query(or_=name_query(query['q']))
if 'platform' in show and query['platform'] in amo.PLATFORM_DICT:
ps = (amo.PLATFORM_DICT[query['platform']].id, amo.PLATFORM_ALL.id)
qs = qs.filter(platform__in=ps)
# If we've selected "All Systems" don't filter by platform.
if ps[0] != ps[1]:
qs = qs.filter(platform__in=ps)
if 'appver' in show:
# Get a min version less than X.0.
low = version_int(query['appver'])
Expand Down

0 comments on commit 2983071

Please sign in to comment.