Skip to content

Commit

Permalink
Requested Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bansalnitish committed Feb 28, 2018
1 parent 100e2df commit 741eb44
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
28 changes: 27 additions & 1 deletion readthedocs/builds/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.utils.decorators import method_decorator
from requests.utils import quote
from future.backports.urllib.parse import urlparse

from readthedocs.builds.models import Build, Version
from readthedocs.core.utils import trigger_build
Expand Down Expand Up @@ -82,11 +84,35 @@ class BuildDetail(BuildBase, DetailView):
def get_context_data(self, **kwargs):
context = super(BuildDetail, self).get_context_data(**kwargs)
context['project'] = self.project
scheme = ("https://github.com/rtfd/readthedocs.org/issues/new"
"?title={title}{build_id}"
"&body={body}")

body = ("# Details:\n\n"
"*Project URL: https://readthedocs.org/projects/{projname}/\n"
"*Build URL(if applicable): https://readthedocs.org{build_path}\n"
"*Read the Docs username(if applicable): {uname}\n\n"
"## Expected Result\n\n"
"*A description of what you wanted to happen*\n\n"
"## Actual Result\n\n"
"*A description of what actually happened*")

body_dict = {'projname': self.project,
'build_path': self.request.path,
'uname': self.request.user}

scheme_dict = {'title': quote("Build error with build id #"),
'build_id': self.request.path[-2:-1],
'body': quote(body.format(**body_dict))}

issue_url = scheme.format(**scheme_dict)
issue_url = urlparse(issue_url).geturl()
context['issue_url'] = issue_url
return context


# Old build view redirects


def builds_redirect_list(request, project_slug): # pylint: disable=unused-argument
return HttpResponsePermanentRedirect(reverse('builds_project_list', args=[project_slug]))

Expand Down
11 changes: 2 additions & 9 deletions readthedocs/templates/builds/build_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,8 @@ <h3>{% trans "Error" %}</h3>
{{ build.error }}
</p>
<p>
{% blocktrans with build_id=build.pk proj_name=build.project.name build_path=request.get_full_path user_name=request.user %}
Report any build issues <a href="https://github.com/rtfd/readthedocs.org/issues/new?
title=Build%20error%20with%20build%20id%20%23{{ build_id }}
&body=%23%23%20Details%0A%0A
*%20Project%20Url%3A%20https://readthedocs.org/projects/{{ proj_name }}/%0A
*%20Build%20URL%20(if%20applicable)%3A%20https://readthedocs.org{{ build_path }}%0A
*%20Read%20the%20Docs%20username%20(if%20applicable)%3A%20{{ user_name }}%0A%0A
%23%23%20Expected%20Result%0A%0A*%20A%20description%20of%20what%20you%20wanted%20to%20happen*%0A%0A
%23%23%20Actual%20Result%0A%0A*A%20description%20of%20what%20actually%20happened*%0A">here</a>.
{% blocktrans with url=issue_url %}
Report any build issues <a href="{{ url }}">here</a>.
{% endblocktrans %}
</p>
</div>
Expand Down

0 comments on commit 741eb44

Please sign in to comment.