Skip to content

Commit 32271e6

Browse files
committed
Merge branch 'master' into remove-highlight-url-params
2 parents fc7c286 + 00ab116 commit 32271e6

File tree

27 files changed

+505
-260
lines changed

27 files changed

+505
-260
lines changed

CHANGELOG.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1+
Version 3.7.3
2+
-------------
3+
4+
:Date: August 27, 2019
5+
6+
* `@pllim <http://github.com/pllim>`__: Use the force when fetching with Git (`#6109 <https://github.com/readthedocs/readthedocs.org/pull/6109>`__)
7+
* `@davidfischer <http://github.com/davidfischer>`__: Small improvements to the SEO guide (`#6105 <https://github.com/readthedocs/readthedocs.org/pull/6105>`__)
8+
* `@davidfischer <http://github.com/davidfischer>`__: Update intersphinx mapping with canonical sources (`#6085 <https://github.com/readthedocs/readthedocs.org/pull/6085>`__)
9+
* `@davidfischer <http://github.com/davidfischer>`__: Fix lingering 500 issues (`#6079 <https://github.com/readthedocs/readthedocs.org/pull/6079>`__)
10+
* `@davidfischer <http://github.com/davidfischer>`__: Technical docs SEO guide (`#6077 <https://github.com/readthedocs/readthedocs.org/pull/6077>`__)
11+
* `@saadmk11 <http://github.com/saadmk11>`__: GitLab Build Status Reporting for PR Builder (`#6076 <https://github.com/readthedocs/readthedocs.org/pull/6076>`__)
12+
* `@davidfischer <http://github.com/davidfischer>`__: Update ad details docs (`#6074 <https://github.com/readthedocs/readthedocs.org/pull/6074>`__)
13+
* `@davidfischer <http://github.com/davidfischer>`__: Gold makes projects ad-free again (`#6073 <https://github.com/readthedocs/readthedocs.org/pull/6073>`__)
14+
* `@saadmk11 <http://github.com/saadmk11>`__: Auto Sync and Re-Sync for Manually Created Integrations (`#6071 <https://github.com/readthedocs/readthedocs.org/pull/6071>`__)
15+
* `@pyup-bot <http://github.com/pyup-bot>`__: pyup: Scheduled weekly dependency update for week 32 (`#6067 <https://github.com/readthedocs/readthedocs.org/pull/6067>`__)
16+
* `@saadmk11 <http://github.com/saadmk11>`__: PR Builder GitLab Integration (`#6066 <https://github.com/readthedocs/readthedocs.org/pull/6066>`__)
17+
* `@davidfischer <http://github.com/davidfischer>`__: Send media downloads to analytics (`#6063 <https://github.com/readthedocs/readthedocs.org/pull/6063>`__)
18+
* `@davidfischer <http://github.com/davidfischer>`__: IPv6 in X-Forwarded-For fix (`#6062 <https://github.com/readthedocs/readthedocs.org/pull/6062>`__)
19+
* `@humitos <http://github.com/humitos>`__: Remove warning about beta state of conda support (`#6056 <https://github.com/readthedocs/readthedocs.org/pull/6056>`__)
20+
* `@saadmk11 <http://github.com/saadmk11>`__: Update GitLab Webhook creating to enable merge request events (`#6055 <https://github.com/readthedocs/readthedocs.org/pull/6055>`__)
21+
* `@ericholscher <http://github.com/ericholscher>`__: Release 3.7.2 (`#6054 <https://github.com/readthedocs/readthedocs.org/pull/6054>`__)
22+
* `@dojutsu-user <http://github.com/dojutsu-user>`__: Update feature flags docs (`#6053 <https://github.com/readthedocs/readthedocs.org/pull/6053>`__)
23+
* `@saadmk11 <http://github.com/saadmk11>`__: Add indelx.html filename to the external doc url (`#6051 <https://github.com/readthedocs/readthedocs.org/pull/6051>`__)
24+
* `@dojutsu-user <http://github.com/dojutsu-user>`__: Search analytics improvements (`#6050 <https://github.com/readthedocs/readthedocs.org/pull/6050>`__)
25+
* `@stsewd <http://github.com/stsewd>`__: Sort versions taking into consideration the vcs type (`#6049 <https://github.com/readthedocs/readthedocs.org/pull/6049>`__)
26+
* `@humitos <http://github.com/humitos>`__: Avoid returning invalid domain when using USE_SUBDOMAIN=True in dev (`#6026 <https://github.com/readthedocs/readthedocs.org/pull/6026>`__)
27+
* `@dojutsu-user <http://github.com/dojutsu-user>`__: Search analytics (`#6019 <https://github.com/readthedocs/readthedocs.org/pull/6019>`__)
28+
* `@tapaswenipathak <http://github.com/tapaswenipathak>`__: Remove django-guardian model (`#6005 <https://github.com/readthedocs/readthedocs.org/pull/6005>`__)
29+
* `@stsewd <http://github.com/stsewd>`__: Add manager and description field to AutomationRule model (`#5995 <https://github.com/readthedocs/readthedocs.org/pull/5995>`__)
30+
* `@davidfischer <http://github.com/davidfischer>`__: Cleanup project tags (`#5983 <https://github.com/readthedocs/readthedocs.org/pull/5983>`__)
31+
* `@davidfischer <http://github.com/davidfischer>`__: Search indexing with storage (`#5854 <https://github.com/readthedocs/readthedocs.org/pull/5854>`__)
32+
* `@wilvk <http://github.com/wilvk>`__: fix sphinx startup guide to not to fail on rtd build as per #2569 (`#5753 <https://github.com/readthedocs/readthedocs.org/pull/5753>`__)
33+
134
Version 3.7.2
235
-------------
336

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ def get_version():
5454
exclude_patterns = ['_build']
5555
default_role = 'obj'
5656
intersphinx_mapping = {
57-
'python': ('https://python.readthedocs.io/en/latest/', None),
58-
'django': ('https://django.readthedocs.io/en/1.11.x/', None),
57+
'python': ('https://docs.python.org/3.6/', None),
58+
'django': ('https://docs.djangoproject.com/en/1.11/', 'https://docs.djangoproject.com/en/1.11/_objects/'),
5959
'sphinx': ('https://www.sphinx-doc.org/en/master/', None),
6060
}
6161
htmlhelp_basename = 'ReadTheDocsdoc'

docs/guides/technical-docs-seo-guide.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ To summarize some of the most important aspects
5858
as they apply to technical documentation, your site should:
5959

6060
* Use descriptive and accurate titles in the HTML ``<title>`` tag.
61+
For Sphinx, the ``<title>`` comes from the first heading on the page.
6162
* Ensure your URLs are descriptive. They are displayed in search results.
63+
Sphinx uses the source filename without the file extension as the URL.
64+
* Make sure the words your readers would search for to find your site
65+
are actually included on your pages.
6266
* Avoid low content pages or pages with very little original content.
6367
* Avoid tactics that attempt to increase your search engine ranking
6468
without actually improving content.

media/css/core.css

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,11 @@ a.cta-btn:hover, a.cta-btn:active {
379379

380380
/* search */
381381

382-
.search {
383-
border-bottom: solid 1px #bfbfbf;
384-
margin-bottom: 24px;
385-
}
382+
.search { border-bottom: solid 1px #bfbfbf; margin-bottom: 24px; }
386383
.search input[type=text] { float: left; margin-right: 10px; padding: 8px 10px; }
387384
.search input[type=submit] { margin-top: 0; }
385+
/* this is same as the css class ".highlighted" */
386+
.search-result-item span { background-color: #ee9; padding: 0 1px; margin: 0 1px; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; }
388387

389388
.filter { margin-bottom: 1em; }
390389
.filter dd { display: inline-block; margin-right: 0.75em; }

readthedocs/builds/managers.py

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
# -*- coding: utf-8 -*-
2-
31
"""Build and Version class model Managers."""
42

53
import logging
64

7-
from django.db import models
85
from django.core.exceptions import ObjectDoesNotExist
6+
from django.db import models
7+
from polymorphic.managers import PolymorphicManager
98

109
from readthedocs.core.utils.extend import (
1110
SettingsOverrideObject,
@@ -14,14 +13,15 @@
1413

1514
from .constants import (
1615
BRANCH,
16+
EXTERNAL,
1717
LATEST,
1818
LATEST_VERBOSE_NAME,
1919
STABLE,
2020
STABLE_VERBOSE_NAME,
2121
TAG,
22-
EXTERNAL,
2322
)
24-
from .querysets import VersionQuerySet, BuildQuerySet
23+
from .querysets import BuildQuerySet, VersionQuerySet
24+
2525

2626
log = logging.getLogger(__name__)
2727

@@ -179,3 +179,48 @@ class InternalBuildManager(SettingsOverrideObject):
179179

180180
class ExternalBuildManager(SettingsOverrideObject):
181181
_default_class = ExternalBuildManagerBase
182+
183+
184+
class VersionAutomationRuleManager(PolymorphicManager):
185+
186+
"""
187+
Mananger for VersionAutomationRule.
188+
189+
.. note::
190+
191+
This manager needs to inherit from PolymorphicManager,
192+
since the model is a PolymorphicModel.
193+
See https://django-polymorphic.readthedocs.io/page/managers.html
194+
"""
195+
196+
def add_rule(
197+
self, *, project, description, match_arg, version_type,
198+
action, action_arg=None,
199+
):
200+
"""
201+
Append an automation rule to `project`.
202+
203+
The rule is created with a priority lower than the last rule
204+
in `project`.
205+
"""
206+
last_priority = (
207+
project.automation_rules
208+
.values_list('priority', flat=True)
209+
.order_by('priority')
210+
.last()
211+
)
212+
if last_priority is None:
213+
priority = 0
214+
else:
215+
priority = last_priority + 1
216+
217+
rule = self.create(
218+
project=project,
219+
priority=priority,
220+
description=description,
221+
match_arg=match_arg,
222+
version_type=version_type,
223+
action=action,
224+
action_arg=action_arg,
225+
)
226+
return rule
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.22 on 2019-07-25 17:24
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('builds', '0009_added_external_version_type'),
12+
]
13+
14+
operations = [
15+
migrations.AddField(
16+
model_name='versionautomationrule',
17+
name='description',
18+
field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Description'),
19+
),
20+
]

readthedocs/builds/models.py

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,52 +17,31 @@
1717
from polymorphic.models import PolymorphicModel
1818

1919
import readthedocs.builds.automation_actions as actions
20-
from readthedocs.config import LATEST_CONFIGURATION_VERSION
21-
from readthedocs.core.utils import broadcast
22-
from readthedocs.projects.constants import (
23-
BITBUCKET_COMMIT_URL,
24-
BITBUCKET_URL,
25-
GITHUB_BRAND,
26-
GITHUB_COMMIT_URL,
27-
GITHUB_URL,
28-
GITHUB_PULL_REQUEST_URL,
29-
GITHUB_PULL_REQUEST_COMMIT_URL,
30-
GITLAB_BRAND,
31-
GITLAB_COMMIT_URL,
32-
GITLAB_MERGE_REQUEST_URL,
33-
GITLAB_MERGE_REQUEST_COMMIT_URL,
34-
GITLAB_URL,
35-
PRIVACY_CHOICES,
36-
PRIVATE,
37-
MEDIA_TYPES,
38-
)
39-
from readthedocs.projects.models import APIProject, Project
40-
from readthedocs.projects.version_handling import determine_stable_version
41-
4220
from readthedocs.builds.constants import (
4321
BRANCH,
4422
BUILD_STATE,
4523
BUILD_STATE_FINISHED,
4624
BUILD_STATE_TRIGGERED,
4725
BUILD_TYPES,
26+
EXTERNAL,
4827
GENERIC_EXTERNAL_VERSION_NAME,
4928
GITHUB_EXTERNAL_VERSION_NAME,
5029
GITLAB_EXTERNAL_VERSION_NAME,
5130
INTERNAL,
5231
LATEST,
5332
NON_REPOSITORY_VERSIONS,
54-
EXTERNAL,
5533
STABLE,
5634
TAG,
5735
VERSION_TYPES,
5836
)
5937
from readthedocs.builds.managers import (
60-
VersionManager,
61-
InternalVersionManager,
62-
ExternalVersionManager,
6338
BuildManager,
64-
InternalBuildManager,
6539
ExternalBuildManager,
40+
ExternalVersionManager,
41+
InternalBuildManager,
42+
InternalVersionManager,
43+
VersionAutomationRuleManager,
44+
VersionManager,
6645
)
6746
from readthedocs.builds.querysets import (
6847
BuildQuerySet,
@@ -75,7 +54,27 @@
7554
get_gitlab_username_repo,
7655
)
7756
from readthedocs.builds.version_slug import VersionSlugField
78-
from readthedocs.oauth.models import RemoteRepository
57+
from readthedocs.config import LATEST_CONFIGURATION_VERSION
58+
from readthedocs.core.utils import broadcast
59+
from readthedocs.projects.constants import (
60+
BITBUCKET_COMMIT_URL,
61+
BITBUCKET_URL,
62+
GITHUB_BRAND,
63+
GITHUB_COMMIT_URL,
64+
GITHUB_PULL_REQUEST_COMMIT_URL,
65+
GITHUB_PULL_REQUEST_URL,
66+
GITHUB_URL,
67+
GITLAB_BRAND,
68+
GITLAB_COMMIT_URL,
69+
GITLAB_MERGE_REQUEST_COMMIT_URL,
70+
GITLAB_MERGE_REQUEST_URL,
71+
GITLAB_URL,
72+
MEDIA_TYPES,
73+
PRIVACY_CHOICES,
74+
PRIVATE,
75+
)
76+
from readthedocs.projects.models import APIProject, Project
77+
from readthedocs.projects.version_handling import determine_stable_version
7978

8079

8180
log = logging.getLogger(__name__)
@@ -962,6 +961,12 @@ class VersionAutomationRule(PolymorphicModel, TimeStampedModel):
962961
_('Rule priority'),
963962
help_text=_('A lower number (0) means a higher priority'),
964963
)
964+
description = models.CharField(
965+
_('Description'),
966+
max_length=255,
967+
null=True,
968+
blank=True,
969+
)
965970
match_arg = models.CharField(
966971
_('Match argument'),
967972
help_text=_('Value used for the rule to match the version'),
@@ -985,6 +990,8 @@ class VersionAutomationRule(PolymorphicModel, TimeStampedModel):
985990
choices=VERSION_TYPES,
986991
)
987992

993+
objects = VersionAutomationRuleManager()
994+
988995
class Meta:
989996
unique_together = (('project', 'priority'),)
990997
ordering = ('priority', '-modified', '-created')
@@ -1028,6 +1035,11 @@ def apply_action(self, version, match_result):
10281035
raise NotImplementedError
10291036
action(version, match_result, self.action_arg)
10301037

1038+
def get_description(self):
1039+
if self.description:
1040+
return self.description
1041+
return f'{self.get_action_display()}'
1042+
10311043
def __str__(self):
10321044
class_name = self.__class__.__name__
10331045
return (

readthedocs/core/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def process_request(self, request):
6161
# Serve CNAMEs
6262
if (
6363
public_domain not in host and
64-
settings.PRODUCTION_DOMAIN not in host and
64+
settings.PRODUCTION_DOMAIN not in (host, full_host) and
6565
'localhost' not in host and
6666
'testserver' not in host
6767
):

readthedocs/core/static-src/core/js/doc-embed/search.js

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ function attach_elastic_search_query(data) {
8080
var link = doc.link + DOCUMENTATION_OPTIONS.FILE_SUFFIX;
8181

8282
var item = $('<a>', {'href': link});
83+
8384
item.html(title);
8485
item.find('span').addClass('highlighted');
8586
list_item.append(item);
@@ -88,7 +89,6 @@ function attach_elastic_search_query(data) {
8889
if (doc.project !== project) {
8990
var text = " (from project " + doc.project + ")";
9091
var extra = $('<span>', {'text': text});
91-
9292
list_item.append(extra);
9393
}
9494

@@ -103,10 +103,12 @@ function attach_elastic_search_query(data) {
103103
var content = "";
104104

105105
var domain = "";
106-
var domain_subtitle = "";
106+
var domain_role_name = "";
107107
var domain_subtitle_link = "";
108-
var domain_content = "";
109108
var domain_name = "";
109+
var domain_subtitle = "";
110+
var domain_content = "";
111+
var domain_docstrings = "";
110112

111113
var section_template = '' +
112114
'<div>' +
@@ -136,7 +138,7 @@ function attach_elastic_search_query(data) {
136138
section = inner_hits[j];
137139
section_subtitle = section._source.title;
138140
section_subtitle_link = link + "#" + section._source.id;
139-
section_content = [section._source.content.substring(0, MAX_SUBSTRING_LIMIT) + " ..."];
141+
section_content = [section._source.content.substr(0, MAX_SUBSTRING_LIMIT) + " ..."];
140142

141143
if (section.highlight) {
142144
if (section.highlight["sections.title"]) {
@@ -171,27 +173,29 @@ function attach_elastic_search_query(data) {
171173
if (inner_hits[j].type === "domains") {
172174

173175
domain = inner_hits[j];
174-
domain_subtitle = domain._source.role_name;
176+
domain_role_name = domain._source.role_name;
175177
domain_subtitle_link = link + "#" + domain._source.anchor;
176-
domain_content = "";
177178
domain_name = domain._source.name;
179+
domain_subtitle = "";
180+
domain_content = "";
181+
domain_docstrings = "";
178182

179-
if (
180-
typeof domain._source.display_name === "string" &&
181-
domain._source.display_name.length >= 1
182-
) {
183-
domain_subtitle = "(" + domain._source.role_name + ") " + domain._source.display_name;
183+
if (domain._source.docstrings !== "") {
184+
domain_docstrings = domain._source.docstrings.substr(0, MAX_SUBSTRING_LIMIT) + " ...";
184185
}
185186

186187
if (domain.highlight) {
188+
if (domain.highlight["domains.docstrings"]) {
189+
domain_docstrings = "... " + xss(domain.highlight["domains.docstrings"][0]) + " ...";
190+
}
191+
187192
if (domain.highlight["domains.name"]) {
188-
// domain_content = type_display -- name
189193
domain_name = xss(domain.highlight["domains.name"][0]);
190194
}
191195
}
192196

193-
// domain_content = type_display -- name -- in doc_display
194-
domain_content = domain._source.type_display + " -- " + domain_name + " -- in " + domain._source.doc_display;
197+
domain_subtitle = "[" + domain_role_name + "]: " + domain_name;
198+
domain_content = domain_docstrings;
195199

196200
append_html_to_contents(
197201
contents,

readthedocs/core/static/core/js/readthedocs-doc-embed.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readthedocs/projects/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,7 @@ def get_processed_json(self):
13051305
'path': file_path,
13061306
'title': '',
13071307
'sections': [],
1308+
'domain_data': {},
13081309
}
13091310

13101311
@cached_property

0 commit comments

Comments
 (0)