|
11 | 11 | from django.contrib.auth.decorators import login_required
|
12 | 12 | from django.core.urlresolvers import reverse
|
13 | 13 | from django.utils.decorators import method_decorator
|
| 14 | +from requests.utils import quote |
| 15 | +from future.backports.urllib.parse import urlparse |
14 | 16 |
|
15 | 17 | from readthedocs.builds.models import Build, Version
|
16 | 18 | from readthedocs.core.utils import trigger_build
|
@@ -82,6 +84,28 @@ class BuildDetail(BuildBase, DetailView):
|
82 | 84 | def get_context_data(self, **kwargs):
|
83 | 85 | context = super(BuildDetail, self).get_context_data(**kwargs)
|
84 | 86 | context['project'] = self.project
|
| 87 | + scheme = ("https://github.com/rtfd/readthedocs.org/issues/new" |
| 88 | + "?title={title}{build_id}" |
| 89 | + "&body={body}") |
| 90 | + |
| 91 | + body = ("# Details:\n\n" |
| 92 | + "*Project URL: https://readthedocs.org/projects/{projname}/\n" |
| 93 | + "*Build URL(if applicable): https://readthedocs.org{build_path}\n" |
| 94 | + "*Read the Docs username(if applicable): {uname}\n\n" |
| 95 | + "## Expected Result\n\n" |
| 96 | + "*A description of what you wanted to happen*\n\n" |
| 97 | + "## Actual Result\n\n" |
| 98 | + "*A description of what actually happened*").format( |
| 99 | + projname=self.project, build_path=self.request.path, |
| 100 | + uname=self.request.user) |
| 101 | + |
| 102 | + scheme_dict = {'title': quote("Build error with build id #"), |
| 103 | + 'build_id': context['build'].id, |
| 104 | + 'body': quote(body)} |
| 105 | + |
| 106 | + issue_url = scheme.format(**scheme_dict) |
| 107 | + issue_url = urlparse(issue_url).geturl() |
| 108 | + context['issue_url'] = issue_url |
85 | 109 | return context
|
86 | 110 |
|
87 | 111 |
|
|
0 commit comments