Skip to content

Commit

Permalink
Fixes webcompat#1276 Added a referer header when new issues are crea…
Browse files Browse the repository at this point in the history
…ted and redirect to issue page
  • Loading branch information
nj4710 committed Apr 5, 2017
1 parent 669123e commit 2f27873
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions webcompat/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from webcompat.api.endpoints import get_rate_limit
from webcompat.db import User
from webcompat.db import session_db
from urlparse import urlparse


@app.teardown_appcontext
Expand Down Expand Up @@ -119,7 +120,6 @@ def file_issue():
response = report_issue(session['form_data'])
# Get rid of stashed form data
session.pop('form_data', None)
session['show_thanks'] = True
return redirect(url_for('show_issue', number=response.get('number')))


Expand Down Expand Up @@ -193,15 +193,13 @@ def create_issue():
if form.get('submit-type') == AUTH_REPORT:
if g.user: # If you're already authed, submit the bug.
response = report_issue(form)
session['show_thanks'] = True
return redirect(url_for('show_issue',
number=response.get('number')))
else: # Stash form data into session, go do GitHub auth
session['form_data'] = form
return redirect(url_for('login'))
elif form.get('submit-type') == PROXY_REPORT:
response = report_issue(form, proxy=True).json()
session['show_thanks'] = True
return redirect(url_for('show_issue', number=response.get('number')))


Expand All @@ -211,9 +209,10 @@ def show_issue(number):
'''Route to display a single issue.'''
if g.user:
get_user_info()
if session.get('show_thanks'):
flash(number, 'thanks')
session.pop('show_thanks')
if request.referrer:
url_path = urlparse(request.referrer).path
if url_path == '/issues/new':
flash(number, 'thanks')
return render_template('issue.html', number=number)


Expand Down

0 comments on commit 2f27873

Please sign in to comment.