From dda848ac7abb3a0b27565a5a2e5c560fe3e573c3 Mon Sep 17 00:00:00 2001 From: David Fischer Date: Thu, 5 Jul 2018 12:14:22 -0700 Subject: [PATCH] A project can be ad-free by having 'gold_owners' --- readthedocs/doc_builder/backends/mkdocs.py | 2 +- .../doc_builder/templates/doc_builder/conf.py.tmpl | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/readthedocs/doc_builder/backends/mkdocs.py b/readthedocs/doc_builder/backends/mkdocs.py index 0815bc5a2c8..c33931fbe16 100644 --- a/readthedocs/doc_builder/backends/mkdocs.py +++ b/readthedocs/doc_builder/backends/mkdocs.py @@ -172,10 +172,10 @@ def generate_rtd_data(self, docs_dir, mkdocs_config): 'docroot': docs_dir, 'source_suffix': ".md", 'api_host': getattr(settings, 'PUBLIC_API_URL', 'https://readthedocs.org'), + 'ad_free': self.project.ad_free or self.project.gold_owners.exists(), 'commit': self.version.project.vcs_repo(self.version.slug).commit, 'global_analytics_code': getattr(settings, 'GLOBAL_ANALYTICS_CODE', 'UA-17997319-1'), 'user_analytics_code': analytics_code, - 'ad_free': self.version.project.ad_free, } data_json = json.dumps(readthedocs_data, indent=4) data_ctx = { diff --git a/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl b/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl index 48ff74c4f81..5ac457feb25 100644 --- a/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl +++ b/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl @@ -115,15 +115,10 @@ context = { 'using_theme': (html_theme == "default"), 'new_theme': (html_theme == "sphinx_rtd_theme"), 'source_suffix': SUFFIX, - 'ad_free': {% if project.ad_free %}True{% else %}False{% endif %}, + 'ad_free': {% if project.gold_owners.exists or project.ad_free %}True{% else %}False{% endif %}, 'user_analytics_code': '{{ project.analytics_code|default_if_none:'' }}', 'global_analytics_code': '{{ settings.GLOBAL_ANALYTICS_CODE }}', - {% if project.repo_type == 'git' %} - 'commit': '{{ commit|slice:"8" }}', - {% else %} - 'commit': '{{ commit }}', - {% endif %} - + 'commit': {% if project.repo_type == 'git' %}'{{ commit|slice:"8" }}'{% else %}'{{ commit }}'{% endif %}, } {# Provide block for extending context data from child template #}