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

Fixes #634: load results from q param (for logged in users) #638

Merged
merged 2 commits into from
Jun 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tests/functional/issue-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,22 @@ define([
});
},

'results are loaded from the query params': function() {
var params = '?q=vladvlad';
return this.remote
.setFindTimeout(intern.config.wc.pageLoadTimeout)
.get(require.toUrl(url + params))
.findByCssSelector('.wc-IssueItem:nth-of-type(1) a').getVisibleText()
.then(function(text){
assert.include(text, 'vladvlad', 'The search query results show up on the page.');
})
.end()
.getCurrentUrl()
.then(function(currUrl){
assert.include(currUrl, 'q=vladvlad', 'Our params didn\'t go anywhere.');
});
},

'dropdowns reflect state from URL': function() {
var params = '?per_page=25&sort=updated&direction=desc&state=all';

Expand Down
6 changes: 6 additions & 0 deletions webcompat/api/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ def proxy_issues():
'''API endpoint to list all issues from GitHub.'''
params = request.args.copy()

# If there's a q param, then we need to use the Search API
# and load those results. Unfortunately, we restrict search requests
# to logged in users.
if g.user and params.get('q'):
return get_search_results(params.get('q'), params)

if g.user:
issues = github.raw_request('GET', 'repos/{0}'.format(ISSUES_PATH),
params=params)
Expand Down