Skip to content

Commit 0e51ad9

Browse files
committed
Merge branch 'master' into allow-query-params-in-redirects
2 parents a6c8d37 + aace732 commit 0e51ad9

31 files changed

+1183
-427
lines changed

docs/conf.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import sys
77

88
import sphinx_rtd_theme
9-
from recommonmark.parser import CommonMarkParser
109

1110
sys.path.insert(0, os.path.abspath('..'))
1211
sys.path.append(os.path.dirname(__file__))
@@ -29,13 +28,11 @@
2928
'doc_extensions',
3029
'sphinx_tabs.tabs',
3130
'sphinx-prompt',
31+
'recommonmark',
3232
]
3333
templates_path = ['_templates']
3434

3535
source_suffix = ['.rst', '.md']
36-
source_parsers = {
37-
'.md': CommonMarkParser,
38-
}
3936

4037
master_doc = 'index'
4138
project = u'Read the Docs'

docs/faq.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ We deploy readthedocs.org from the `rel` branch in our GitHub repository. You ca
233233

234234

235235
How can I avoid search results having a deprecated version of my docs?
236-
---------------------------------------------------------------------
236+
----------------------------------------------------------------------
237237

238238
If readers search something related to your docs in Google, it will probably return the most relevant version of your documentation.
239239
It may happen that this version is already deprecated and you want to stop Google indexing it as a result,

readthedocs/builds/views.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""Views for builds app."""
44

55
import logging
6+
import textwrap
67

78
from django.contrib import messages
89
from django.contrib.auth.decorators import login_required
@@ -15,7 +16,10 @@
1516
from django.urls import reverse
1617
from django.utils.decorators import method_decorator
1718
from django.views.generic import DetailView, ListView
19+
from requests.utils import quote
20+
from urllib.parse import urlparse
1821

22+
from readthedocs.doc_builder.exceptions import BuildEnvironmentError
1923
from readthedocs.builds.models import Build, Version
2024
from readthedocs.core.permissions import AdminPermission
2125
from readthedocs.core.utils import trigger_build
@@ -104,6 +108,49 @@ class BuildDetail(BuildBase, DetailView):
104108
def get_context_data(self, **kwargs):
105109
context = super().get_context_data(**kwargs)
106110
context['project'] = self.project
111+
112+
build = self.get_object()
113+
if build.error != BuildEnvironmentError.GENERIC_WITH_BUILD_ID.format(build_id=build.pk):
114+
# Do not suggest to open an issue if the error is not generic
115+
return context
116+
117+
scheme = (
118+
'https://github.com/rtfd/readthedocs.org/issues/new'
119+
'?title={title}{build_id}'
120+
'&body={body}'
121+
)
122+
123+
# TODO: we could use ``.github/ISSUE_TEMPLATE.md`` here, but we would
124+
# need to add some variables to it which could impact in the UX when
125+
# filling an issue from the web
126+
body = """
127+
## Details:
128+
129+
* Project URL: https://readthedocs.org/projects/{project_slug}/
130+
* Build URL(if applicable): https://readthedocs.org{build_path}
131+
* Read the Docs username(if applicable): {username}
132+
133+
## Expected Result
134+
135+
*A description of what you wanted to happen*
136+
137+
## Actual Result
138+
139+
*A description of what actually happened*""".format(
140+
project_slug=self.project,
141+
build_path=self.request.path,
142+
username=self.request.user,
143+
)
144+
145+
scheme_dict = {
146+
'title': quote('Build error with build id #'),
147+
'build_id': context['build'].id,
148+
'body': quote(textwrap.dedent(body)),
149+
}
150+
151+
issue_url = scheme.format(**scheme_dict)
152+
issue_url = urlparse(issue_url).geturl()
153+
context['issue_url'] = issue_url
107154
return context
108155

109156

0 commit comments

Comments
 (0)