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 #1276 Added a referer header when new issues are created #1466

Closed
wants to merge 1 commit into from
Closed
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
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 is not None:
url_path = urlparse(request.referrer).path
if url_path == '/issues/new':
flash(number, 'thanks')
return render_template('issue.html', number=number)


Expand Down