Skip to content

Commit d4ddfcd

Browse files
committed
Merge tag '9.10.1' into relcorp
2 parents 3a51fe4 + 11760d2 commit d4ddfcd

File tree

121 files changed

+4896
-3478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+4896
-3478
lines changed

.github/workflows/pip-tools.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
run: pip-compile --upgrade --resolver=backtracking --output-file=requirements/deploy.txt requirements/deploy.in
4949

5050
- name: Create Pull Request
51-
uses: peter-evans/create-pull-request@v4
51+
uses: peter-evans/create-pull-request@v5
5252
with:
5353
add-paths: |
5454
requirements/*.txt

CHANGELOG.rst

+26
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
Version 9.10.1
2+
--------------
3+
4+
:Date: April 11, 2023
5+
6+
* `@dependabot[bot] <https://github.com/dependabot[bot]>`__: Bump peter-evans/create-pull-request from 4 to 5 (`#10233 <https://github.com/readthedocs/readthedocs.org/pull/10233>`__)
7+
* `@github-actions[bot] <https://github.com/github-actions[bot]>`__: Dependencies: all packages updated via pip-tools (`#10232 <https://github.com/readthedocs/readthedocs.org/pull/10232>`__)
8+
* `@agjohnson <https://github.com/agjohnson>`__: Add notes on private repo support in our install docs (`#10230 <https://github.com/readthedocs/readthedocs.org/pull/10230>`__)
9+
* `@stsewd <https://github.com/stsewd>`__: Migrate more feature checks (`#10228 <https://github.com/readthedocs/readthedocs.org/pull/10228>`__)
10+
* `@stsewd <https://github.com/stsewd>`__: Analytics API: check if absolute_uri isn't present (`#10227 <https://github.com/readthedocs/readthedocs.org/pull/10227>`__)
11+
* `@humitos <https://github.com/humitos>`__: Docs: minor changes to examples for consistency (`#10225 <https://github.com/readthedocs/readthedocs.org/pull/10225>`__)
12+
* `@benjaoming <https://github.com/benjaoming>`__: Docs: Experiment with canonical url using READTHEDOCS_CANONICAL_URL (`#10224 <https://github.com/readthedocs/readthedocs.org/pull/10224>`__)
13+
* `@github-actions[bot] <https://github.com/github-actions[bot]>`__: Dependencies: all packages updated via pip-tools (`#10215 <https://github.com/readthedocs/readthedocs.org/pull/10215>`__)
14+
* `@stsewd <https://github.com/stsewd>`__: Proxito: refactor allowed_user (`#10213 <https://github.com/readthedocs/readthedocs.org/pull/10213>`__)
15+
* `@stsewd <https://github.com/stsewd>`__: Proxito: Test infinite redirect on non-existing PDFs (`#10212 <https://github.com/readthedocs/readthedocs.org/pull/10212>`__)
16+
* `@stsewd <https://github.com/stsewd>`__: API V3: support privacy levels on projects and versions (`#10210 <https://github.com/readthedocs/readthedocs.org/pull/10210>`__)
17+
* `@agjohnson <https://github.com/agjohnson>`__: Fix filter positional arguments (`#10202 <https://github.com/readthedocs/readthedocs.org/pull/10202>`__)
18+
* `@benjaoming <https://github.com/benjaoming>`__: Docs: Gather definitions in the same dl on main index page (`#10201 <https://github.com/readthedocs/readthedocs.org/pull/10201>`__)
19+
* `@humitos <https://github.com/humitos>`__: Release 9.10.0 (`#10200 <https://github.com/readthedocs/readthedocs.org/pull/10200>`__)
20+
* `@stsewd <https://github.com/stsewd>`__: Custom domains: hide https option (`#10188 <https://github.com/readthedocs/readthedocs.org/pull/10188>`__)
21+
* `@stsewd <https://github.com/stsewd>`__: Proxito: refactor project download view (`#10178 <https://github.com/readthedocs/readthedocs.org/pull/10178>`__)
22+
* `@humitos <https://github.com/humitos>`__: Build: hardcode the Docker username for now (`#10172 <https://github.com/readthedocs/readthedocs.org/pull/10172>`__)
23+
* `@humitos <https://github.com/humitos>`__: Build: expose VCS-related environment variables (`#10168 <https://github.com/readthedocs/readthedocs.org/pull/10168>`__)
24+
* `@agjohnson <https://github.com/agjohnson>`__: Automation rules: model text changes for UI (`#10138 <https://github.com/readthedocs/readthedocs.org/pull/10138>`__)
25+
* `@stsewd <https://github.com/stsewd>`__: Unify feature check for organization/project (`#8920 <https://github.com/readthedocs/readthedocs.org/pull/8920>`__)
26+
127
Version 9.10.0
228
--------------
329

docs/conf.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,16 @@
6565

6666
templates_path = ["_templates"]
6767

68+
# This may be elevated as a general issue for documentation and behavioral
69+
# change to the Sphinx build:
70+
# This will ensure that we use the correctly set environment for canonical URLs
71+
# Old Read the Docs injections makes it point only to the default version,
72+
# for instance /en/stable/
73+
html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "/")
74+
6875
master_doc = "index"
6976
copyright = "Read the Docs, Inc & contributors"
70-
version = "9.10.0"
77+
version = "9.10.1"
7178
release = version
7279
exclude_patterns = ["_build", "shared", "_includes"]
7380
default_role = "obj"

docs/dev/install.rst

+21-4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,27 @@ Set up your environment
3232

3333
git clone --recurse-submodules https://github.com/readthedocs/readthedocs.org/
3434

35+
#. Install or clone additional repositories:
36+
37+
.. note::
38+
39+
This step is only required for Read the Docs core team members.
40+
41+
Core team should at very least have all required packages installed in their development image.
42+
To install these packages you must define a GitHub token before building your image:
43+
44+
.. prompt:: bash
45+
46+
export GITHUB_TOKEN="..."
47+
export GITHUB_USER="..."
48+
49+
In order to make development changes on any of our private repositories,
50+
such as ``ext`` or ``ext-theme``, you will also need to check these repositories out:
51+
52+
.. prompt:: bash
53+
54+
git clone --recurse-submodules https://github.com/readthedocs/ext/
55+
3556
#. Install the requirements from ``common`` submodule:
3657

3758
.. prompt:: bash
@@ -48,10 +69,6 @@ Set up your environment
4869

4970
inv docker.build
5071

51-
.. tip::
52-
53-
If you pass the ``GITHUB_TOKEN`` and ``GITHUB_USER`` environment variables to this command,
54-
it will add support for readthedocs-ext.
5572

5673
#. Pull down Docker images for the builders:
5774

docs/user/api/v3.rst

+19-4
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,8 @@ Project details
277277
"latest": "{VERSION}",
278278
"19.0.2": "{VERSION}"
279279
},
280+
"privacy_level": "public",
281+
"external_builds_privacy_level": "public",
280282
"_links": {
281283
"_self": "/api/v3/projects/pip/",
282284
"versions": "/api/v3/projects/pip/versions/",
@@ -302,7 +304,6 @@ Project details
302304

303305
* **expand** (*string*) -- with ``organization`` and ``teams``.
304306

305-
306307
Project create
307308
++++++++++++++
308309

@@ -350,6 +351,8 @@ Project create
350351
"homepage": "http://template.readthedocs.io/",
351352
"programming_language": "py",
352353
"language": "es",
354+
"privacy_level": "public",
355+
"external_builds_privacy_level": "public",
353356
"tags": [
354357
"automation",
355358
"sphinx"
@@ -371,6 +374,9 @@ Project create
371374
* **organization** (*string*) -- required organization's slug under the project will be imported.
372375
* **teams** (*string*) -- optional teams' slugs the project will belong to.
373376

377+
.. note::
378+
379+
Privacy levels are only available in :doc:`Read the Docs for Business </commercial/index>`.
374380

375381
Project update
376382
++++++++++++++
@@ -429,14 +435,19 @@ Project update
429435
"analytics_disabled": false,
430436
"single_version": false,
431437
"external_builds_enabled": true,
432-
438+
"privacy_level": "public",
439+
"external_builds_privacy_level": "public"
433440
}
434441

435442
.. note::
436443

437444
Adding ``tags`` will replace existing tags with the new list,
438445
and if omitted won't change the tags.
439446

447+
.. note::
448+
449+
Privacy levels are only available in :doc:`Read the Docs for Business </commercial/index>`.
450+
440451
:statuscode 204: Updated successfully
441452

442453

@@ -534,6 +545,7 @@ Version detail
534545
"hidden": false,
535546
"type": "tag",
536547
"last_build": "{BUILD}",
548+
"privacy_level": "public",
537549
"downloads": {
538550
"pdf": "https://pip.readthedocs.io/_/downloads/pdf/pip/stable/",
539551
"htmlzip": "https://pip.readthedocs.io/_/downloads/htmlzip/pip/stable/",
@@ -561,7 +573,6 @@ Version detail
561573
Allowed values are ``last_build`` and ``last_build.config``.
562574
Multiple fields can be passed separated by commas.
563575

564-
565576
Version update
566577
++++++++++++++
567578

@@ -602,11 +613,15 @@ Version update
602613

603614
{
604615
"active": true,
605-
"hidden": false
616+
"hidden": false,
617+
"privacy_level": "public"
606618
}
607619

608620
:statuscode 204: Updated successfully
609621

622+
.. note::
623+
624+
Privacy levels are only available in :doc:`Read the Docs for Business </commercial/index>`.
610625

611626
Builds
612627
~~~~~~

docs/user/reference/environment-variables.rst

+9-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ All :doc:`build processes </builds>` have the following environment variables au
1818
The locale name, or the identifier for the locale, for the project being built.
1919
This value comes from the project's configured language.
2020

21-
:Examples: ``en``, ``it``, ``de_AT``, ``es``, ``pt_BR``
21+
:Example: ``en``
22+
:Example: ``it``
23+
:Example: ``de_AT``
24+
:Example: ``es``
25+
:Example: ``pt_BR``
2226

2327
.. envvar:: READTHEDOCS_VERSION
2428

@@ -35,7 +39,10 @@ All :doc:`build processes </builds>` have the following environment variables au
3539

3640
The type of the version being built.
3741

38-
:Values: ``branch``, ``tag``, ``external`` (for :doc:`pull request builds </pull-requests>`), or ``unknown``
42+
:Example: ``branch``
43+
:Example: ``tag``
44+
:Example: ``external`` (for :doc:`pull request builds </pull-requests>`)
45+
:Example: ``unknown``
3946

4047
.. envvar:: READTHEDOCS_VIRTUALENV_PATH
4148

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "readthedocs",
3-
"version": "9.10.0",
3+
"version": "9.10.1",
44
"description": "Read the Docs build dependencies",
55
"author": "Read the Docs, Inc <[email protected]>",
66
"scripts": {

readthedocs/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""Read the Docs."""
22

33

4-
__version__ = "9.10.0"
4+
__version__ = "9.10.1"

readthedocs/analytics/proxied_api.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@ def get(self, request, *args, **kwargs):
5353
project = self._get_project()
5454
version = self._get_version()
5555
absolute_uri = self.request.GET.get('absolute_uri')
56-
self.increase_page_view_count(
57-
project=project,
58-
version=version,
59-
absolute_uri=absolute_uri,
60-
)
56+
if absolute_uri:
57+
self.increase_page_view_count(
58+
project=project,
59+
version=version,
60+
absolute_uri=absolute_uri,
61+
)
6162
return Response(status=200)
6263

6364
# pylint: disable=no-self-use

readthedocs/api/v2/views/proxied.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from readthedocs.api.v2.views.footer_views import BaseFooterHTML
2-
from readthedocs.core.utils.extend import SettingsOverrideObject
3-
from readthedocs.embed.views import EmbedAPIBase
42
from readthedocs.core.mixins import ProxiedAPIMixin
3+
from readthedocs.core.utils.extend import SettingsOverrideObject
4+
from readthedocs.embed.views import EmbedAPI
55

66

77
class BaseProxiedFooterHTML(ProxiedAPIMixin, BaseFooterHTML):
@@ -14,7 +14,7 @@ class ProxiedFooterHTML(SettingsOverrideObject):
1414
_default_class = BaseProxiedFooterHTML
1515

1616

17-
class ProxiedEmbedAPIBase(ProxiedAPIMixin, EmbedAPIBase):
17+
class ProxiedEmbedAPIBase(ProxiedAPIMixin, EmbedAPI):
1818

1919
pass
2020

readthedocs/api/v3/permissions.py

+26
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
11
from rest_framework.permissions import BasePermission, IsAuthenticated
22

33
from readthedocs.core.utils.extend import SettingsOverrideObject
4+
from readthedocs.subscriptions.constants import TYPE_EMBED_API
5+
from readthedocs.subscriptions.models import PlanFeature
6+
7+
8+
class HasEmbedAPIAccess(BasePermission):
9+
10+
"""
11+
Check if the project being accessed has access to the Embed API.
12+
13+
The embedded API V3 allows getting content from external sites tha
14+
aren't attached to a project. Those sites are restricted to the ones
15+
from ``RTD_EMBED_API_EXTERNAL_DOMAINS``, so we just allow that.
16+
"""
17+
18+
message = (
19+
"Content embedding isn't available in your current plan. "
20+
"Upgrade your subscription to enable this feature. "
21+
"https://about.readthedocs.com/pricing/."
22+
)
23+
24+
def has_permission(self, request, view):
25+
project = view._get_project()
26+
# The project is None when the is requesting a section from an external site.
27+
if project and not PlanFeature.objects.has_feature(project, TYPE_EMBED_API):
28+
return False
29+
return True
430

531

632
class UserProjectsListing(BasePermission):

readthedocs/api/v3/serializers.py

+33-1
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ class Meta:
277277
'downloads',
278278
'urls',
279279
'_links',
280+
"privacy_level",
280281
]
281282

282283
expandable_fields = {
@@ -306,16 +307,25 @@ class VersionUpdateSerializer(serializers.ModelSerializer):
306307
"""
307308
Used when modifying (update action) a ``Version``.
308309
309-
It only allows to make the Version active/non-active.
310+
It allows to change the version states and privacy level only.
310311
"""
311312

312313
class Meta:
313314
model = Version
314315
fields = [
315316
'active',
316317
'hidden',
318+
"privacy_level",
317319
]
318320

321+
def __init__(self, *args, **kwargs):
322+
super().__init__(*args, **kwargs)
323+
324+
# If privacy levels are not allowed,
325+
# everything is public, we don't allow changing it.
326+
if not settings.ALLOW_PRIVATE_REPOS:
327+
self.fields.pop("privacy_level")
328+
319329

320330
class LanguageSerializer(serializers.Serializer):
321331

@@ -475,8 +485,18 @@ class Meta:
475485
"repository",
476486
"homepage",
477487
"tags",
488+
"privacy_level",
489+
"external_builds_privacy_level",
478490
)
479491

492+
def __init__(self, *args, **kwargs):
493+
super().__init__(*args, **kwargs)
494+
# If privacy levels are not allowed,
495+
# everything is public, we don't allow changing it.
496+
if not settings.ALLOW_PRIVATE_REPOS:
497+
self.fields.pop("privacy_level")
498+
self.fields.pop("external_builds_privacy_level")
499+
480500
def _validate_remote_repository(self, data):
481501
"""
482502
Validate connection between `Project` and `RemoteRepository`.
@@ -565,11 +585,21 @@ class Meta:
565585
'show_version_warning',
566586
'single_version',
567587
'external_builds_enabled',
588+
"privacy_level",
589+
"external_builds_privacy_level",
568590

569591
# NOTE: we do not allow to change any setting that can be set via
570592
# the YAML config file.
571593
)
572594

595+
def __init__(self, *args, **kwargs):
596+
super().__init__(*args, **kwargs)
597+
# If privacy levels are not allowed,
598+
# everything is public, we don't allow changing it.
599+
if not settings.ALLOW_PRIVATE_REPOS:
600+
self.fields.pop("privacy_level")
601+
self.fields.pop("external_builds_privacy_level")
602+
573603

574604
class ProjectUpdateSerializer(SettingsOverrideObject):
575605
_default_class = ProjectUpdateSerializerBase
@@ -622,6 +652,8 @@ class Meta:
622652
'translation_of',
623653
'urls',
624654
'tags',
655+
"privacy_level",
656+
"external_builds_privacy_level",
625657

626658
# NOTE: ``expandable_fields`` must not be included here. Otherwise,
627659
# they will be tried to be rendered and fail

readthedocs/api/v3/tests/mixins.py

+3
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ def setUp(self):
8080
active=True,
8181
built=True,
8282
type=TAG,
83+
has_pdf=True,
84+
has_epub=True,
85+
has_htmlzip=True,
8386
)
8487

8588
self.build = fixture.get(

0 commit comments

Comments
 (0)