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 #2042: Send details params content via a hidden input. #2395

Merged
merged 7 commits into from
Apr 18, 2018

Conversation

miketaylr
Copy link
Member

The user won't see the pref values until the report has been created. This should be less confusing.

screen shot 2018-04-16 at 1 37 53 pm

@miketaylr
Copy link
Member Author

r? @karlcow

def get_details(details_string):
"""Return details content as a formatted string, if it was JSON. Otherwise,
just return the string as-is."""
# TODO: file a bug and change DecoderDoctor to encode as JSON so we only

This comment was marked as abuse.

This comment was marked as abuse.

Copy link
Member

@karlcow karlcow left a comment

Choose a reason for hiding this comment

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

My only request for change is about details_map

See fit for the rest.

Thanks @miketaylr

{'': ''}, {'cool': 'cool'}, {u'\U0001f480': u'💀'}]
for test in tests:
for output, _input in test.iteritems():
self.assertEqual(get_str_value(_input), output)

This comment was marked as abuse.

This comment was marked as abuse.

{'': ''}, {'cool': 'cool'}, {u'\U0001f480': u'💀'}]
for test in tests:
for output, _input in test.iteritems():
self.assertEqual(get_str_value(_input), output)

This comment was marked as abuse.

This comment was marked as abuse.

try:
details = json.loads(content)
for key, value in details.iteritems():
rv += key + ': ' + get_str_value(value) + '\n'

This comment was marked as abuse.

This comment was marked as abuse.

@@ -74,6 +74,15 @@ def md5_checksum(file_path):
return m.hexdigest()


def get_str_value(val):
detailsMap = {False: 'false', True: 'true', None: 'null'}

This comment was marked as abuse.

details = form_object.get('details')
if details:
body += u'\n\n**Details**\n{details}'.format(
details=get_details(details))

This comment was marked as abuse.

This comment was marked as abuse.

@TravisBuddy
Copy link

TravisBuddy commented Apr 18, 2018

Travis tests have failed

Hey @miketaylr,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

@miketaylr
Copy link
Member Author

@karlcow can you have another look please? The last commit is untested, this airplane wifi is like 28kbps, I don't have the patience to file a test issue (will do tonight or tomorrow).

@karlcow
Copy link
Member

karlcow commented Apr 18, 2018

With your latest modifications.

🐝 10:00:06 ~/code/webcompat.com
→ nosetests
...................................................................................
----------------------------------------------------------------------
Ran 83 tests in 2.624s

OK

This one is difficult to test locally, given this is happening only when we use report site issue…

@karlcow
Copy link
Member

karlcow commented Apr 18, 2018

but nosetests are working locally :)

@karlcow karlcow merged commit fa99d5d into master Apr 18, 2018
@miketaylr miketaylr deleted the issues/2042/1 branch April 18, 2018 16:37
@miketaylr
Copy link
Member Author

thanks!

@miketaylr
Copy link
Member Author

Testing on staging... unsure what's up:

screen shot 2018-04-18 at 9 40 35 am

Will investigate!

@miketaylr
Copy link
Member Author

(this was after clicking "report anonymously")

@miketaylr
Copy link
Member Author

2018/04/18 16:40:22 [error] 16916#0: *96559 upstream prematurely closed connection while reading response header from upstream, client: xxx, server: staging.webcompat.com, request: "POST /issues/new HTTP/1.1", upstream: "xxx/uwsgi-staging.sock:", host: "staging.webcompat.com", referrer: "https://staging.webcompat.com/issues/new?url=https%3A%2F%2Fgithub.com%2Fwebcompat%2Fwebcompat.com%2Fpull%2F2395%23issuecomment-382205773&src=desktop-reporter&details=%7B%22gfx.webrender.all%22%3Afalse%2C%22gfx.webrender.blob-images%22%3A1%2C%22gfx.webrender.enabled%22%3Afalse%2C%22image.mem.shared%22%3A2%7D"

@miketaylr
Copy link
Member Author

Ah, unrelated to nginx. Just a python error:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1994, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1985, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1540, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "./webcompat/views.py", line 229, in create_issue
    response = report_issue(form, proxy=True).json()
  File "./webcompat/issues.py", line 24, in report_issue
    data=json.dumps(build_formdata(form)))
  File "./webcompat/form.py", line 307, in build_formdata
    body += build_details(details)
  File "./webcompat/form.py", line 124, in build_details
    </details>""".format(get_details(details))
KeyError: 'details'

Will file a bug and send in a patch. Yay for untested airplane code. ✈️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants