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 #1515 - fixed encoding param #1518

Merged
merged 6 commits into from
Apr 21, 2017
Merged

Fixes #1515 - fixed encoding param #1518

merged 6 commits into from
Apr 21, 2017

Conversation

magsout
Copy link
Member

@magsout magsout commented Apr 18, 2017

r? @miketaylr

I have fixed the issue #1515 and more.

  • url: param q is encoded with encodeURIComponent to avoid %25
  • input search is set when we refresh page if there is a q param
  • _currentSearch is init directly in this.issueList = new issueList.IssueView(); to avoid double search at first page init.
  • param q is removed of XHR rquest when search input is empty

There is still a bug. When you delete the search field. It is necessary to send a request (ok) and delete the param q (NOK, the test is here https://github.com/webcompat/webcompat.com/blob/master/webcompat/static/js/lib/issue-list.js#L464)

Edit

Seems to fixe this issue #1023

Last bug: Delete the request parameter https://github.com/webcompat/webcompat.com/blob/master/webcompat/static/js/lib/issue-list.js#L464

@miketaylr
Copy link
Member

Whoa, awesome! Will have time to review this afternoon.

@miketaylr
Copy link
Member

@magsout can you push a prettier error fix commit so tests can run?

@magsout
Copy link
Member Author

magsout commented Apr 18, 2017

@magsout can you push a prettier error fix commit so tests can run?

Rah, need to add this issue #1474

@magsout
Copy link
Member Author

magsout commented Apr 18, 2017

@miketaylr hum, hum where is this commit 5998f12 because it fixed the bug like I did.. But I cannot find it..

@magsout
Copy link
Member Author

magsout commented Apr 18, 2017

ok, I get it. I find how to handle my last case, let me push something

edit: or not :(

@miketaylr
Copy link
Member

hum, hum where is this commit 5998f12 because it fixed the bug like I did.. But I cannot find it..

Hmmm...... 👻

@magsout
Copy link
Member Author

magsout commented Apr 18, 2017

@miketaylr I add this https://github.com/webcompat/webcompat.com/pull/1518/files#diff-4ba6be3180115f78e14125480dcf4d7dR499 I don't know if it's clean or not to do like that.

Why I have written this function? When we remove input search we pass here https://github.com/webcompat/webcompat.com/pull/1518/files#diff-4ba6be3180115f78e14125480dcf4d7dR488 or here https://github.com/webcompat/webcompat.com/pull/1518/files#diff-4ba6be3180115f78e14125480dcf4d7dR494

We never delete the param q , so we send every time the same param q in XHR request. It's impossible to reset the search without refresh the page. With this function, I remove param q.

@magsout
Copy link
Member Author

magsout commented Apr 18, 2017

Maybe it's better to make another PR, I fixed lot of things, what do you think @miketaylr ?

@miketaylr
Copy link
Member

Maybe it's better to make another PR, I fixed lot of things, what do you think @miketaylr ?

There's not that much code changing in these 4 commits, I think it should be fine here.

@miketaylr
Copy link
Member

@magsout this looks good, but I'd like to write some tests as well. Can you help me think of the scenarios we should test?

  1. have a type-media label in the test repo, make sure that label:type-media search query returns a result
  2. have a q param with foo, and the search input should load with foo

param q is removed of XHR rquest when search input is empty

How can we test this one?

Copy link
Member

@miketaylr miketaylr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+, but let's write some tests before merging. I'm happy to write the tests, unless you want to @magsout!

@@ -336,14 +336,18 @@ issueList.IssueView = Backbone.View.extend(
// There are some params in the URL
if (urlParams.length !== 0) {
queryMatch = urlParams.match(this._searchRegex);
if (queryMatch) {

This comment was marked as abuse.

This comment was marked as abuse.

@magsout
Copy link
Member Author

magsout commented Apr 18, 2017

@miketaylr is it enought if:

  1. have a q param, make sure that somethingLongLongLong search query returns 0 result
  2. remove q param and make sure that search query returns a result ?

@magsout
Copy link
Member Author

magsout commented Apr 18, 2017

r+, but let's write some tests before merging. I'm happy to write the tests, unless you want to

@miketaylr unless it can be wait one or two weeks, be my guest ;)

@miketaylr
Copy link
Member

:))))) I'll work on these over the next few days.

(the same test also lives in search-non-auth.js)
@miketaylr
Copy link
Member

@miketaylr is it enought if:

Another way would just be to load a page with q=thing, then search for "" and check that q=thing isn't in the URL.

@miketaylr
Copy link
Member

@magsout just pushed some tests, will likely merge tomorrow morning (don't want to break the universe at the end of the day, in case something goes wrong). ❤️

@miketaylr miketaylr merged commit b1a2bdb into master Apr 21, 2017
@miketaylr miketaylr deleted the issues/1515 branch April 21, 2017 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants