Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build: remove usage of addons field #11846

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions readthedocs/api/v2/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ class VersionAdminSerializer(VersionSerializer):
project_serializer_class = ProjectAdminSerializer
canonical_url = serializers.SerializerMethodField()
build_data = serializers.JSONField(required=False, write_only=True, allow_null=True)
addons = serializers.BooleanField(required=False, write_only=True, allow_null=False)

def get_canonical_url(self, obj):
# Use the cached object, since it has some
Expand All @@ -185,7 +184,6 @@ def get_canonical_url(self, obj):

class Meta(VersionSerializer.Meta):
fields = VersionSerializer.Meta.fields + [
"addons",
"build_data",
"canonical_url",
"machine",
Expand Down
9 changes: 0 additions & 9 deletions readthedocs/doc_builder/director.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ def __init__(self, data):
"""
self.data = data

# Reset `addons` field. It will be set to `True` only when it's built via `build.commands`
self.data.version.addons = False

def setup_vcs(self):
"""
Perform all VCS related steps.
Expand Down Expand Up @@ -195,9 +192,6 @@ def build(self):
self.run_build_job("post_build")
self.store_readthedocs_build_yaml()

# Mark this version to inject the new js client when serving it via El Proxito.
self.data.version.addons = True

after_build.send(
sender=self.data.version,
)
Expand Down Expand Up @@ -476,9 +470,6 @@ def run_build_commands(self):
# by the config file. When using `build.commands` it will be `GENERIC`
self.data.version.documentation_type = self.data.config.doctype

# Mark this version to inject the new js client when serving it via El Proxito
self.data.version.addons = True

self.store_readthedocs_build_yaml()

def install_build_tools(self):
Expand Down
4 changes: 2 additions & 2 deletions readthedocs/projects/tests/test_build_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def test_build_updates_documentation_type(self, load_yaml_config):
assert self.requests_mock.request_history[8]._request.method == "PATCH"
assert self.requests_mock.request_history[8].path == "/api/v2/version/1/"
assert self.requests_mock.request_history[8].json() == {
"addons": True,
"addons": False,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not even send the addons fields on these API calls now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because we use a APIVersion model that inherits from the Version model, it will be removed when the field is removed from the model.

"build_data": None,
"built": True,
"documentation_type": "mkdocs",
Expand Down Expand Up @@ -630,7 +630,7 @@ def test_successful_build(
assert self.requests_mock.request_history[8]._request.method == "PATCH"
assert self.requests_mock.request_history[8].path == "/api/v2/version/1/"
assert self.requests_mock.request_history[8].json() == {
"addons": True,
"addons": False,
"build_data": None,
"built": True,
"documentation_type": "sphinx",
Expand Down