From 7d08be54bc29a07c3bd775957ec9d566f945fc1e Mon Sep 17 00:00:00 2001
From: Santos Gallegos
Date: Mon, 4 May 2020 14:30:57 -0500
Subject: [PATCH 01/10] Remove usage of project.privacy_level
---
readthedocs/api/v3/tests/test_projects.py | 3 ---
readthedocs/core/mixins.py | 2 --
readthedocs/projects/forms.py | 4 +--
.../rtd_tests/tests/test_project_forms.py | 26 ++-----------------
.../templates/core/project_detail_right.html | 9 -------
5 files changed, 3 insertions(+), 41 deletions(-)
diff --git a/readthedocs/api/v3/tests/test_projects.py b/readthedocs/api/v3/tests/test_projects.py
index d9998d32041..381f36a9d1c 100644
--- a/readthedocs/api/v3/tests/test_projects.py
+++ b/readthedocs/api/v3/tests/test_projects.py
@@ -131,7 +131,6 @@ def test_import_project(self):
self.assertEqual(project.repo, 'https://github.com/rtfd/template')
self.assertEqual(project.language, 'en')
self.assertEqual(project.programming_language, 'py')
- self.assertEqual(project.privacy_level, 'public')
self.assertEqual(project.project_url, 'http://template.readthedocs.io/')
self.assertIn(self.me, project.users.all())
self.assertEqual(project.builds.count(), 1)
@@ -201,7 +200,6 @@ def test_update_project(self):
'homepage': 'https://updated-homepage.org',
'default_version': 'stable',
'default_branch': 'updated-default-branch',
- 'privacy_level': 'private',
'analytics_code': 'UA-XXXXXX',
'show_version_warning': False,
'single_version': True,
@@ -229,7 +227,6 @@ def test_update_project(self):
self.assertEqual(self.project.project_url, 'https://updated-homepage.org')
self.assertEqual(self.project.default_version, 'stable')
self.assertEqual(self.project.default_branch, 'updated-default-branch')
- self.assertEqual(self.project.privacy_level, 'public')
self.assertEqual(self.project.analytics_code, 'UA-XXXXXX')
self.assertEqual(self.project.show_version_warning, False)
self.assertEqual(self.project.single_version, True)
diff --git a/readthedocs/core/mixins.py b/readthedocs/core/mixins.py
index 2780e168527..6adc330bf41 100644
--- a/readthedocs/core/mixins.py
+++ b/readthedocs/core/mixins.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
"""Common mixin classes for views."""
from django.contrib.auth.mixins import LoginRequiredMixin
diff --git a/readthedocs/projects/forms.py b/readthedocs/projects/forms.py
index c813ec8dbea..01d6d4ffa41 100644
--- a/readthedocs/projects/forms.py
+++ b/readthedocs/projects/forms.py
@@ -14,7 +14,6 @@
from textclassifier.validators import ClassifierValidator
from readthedocs.builds.constants import INTERNAL
-from readthedocs.core.mixins import HideProtectedLevelMixin
from readthedocs.core.utils import slugify, trigger_build
from readthedocs.core.utils.extend import SettingsOverrideObject
from readthedocs.integrations.models import Integration
@@ -190,7 +189,7 @@ def clean_tags(self):
return tags
-class ProjectAdvancedForm(HideProtectedLevelMixin, ProjectTriggerBuildMixin, ProjectForm):
+class ProjectAdvancedForm(ProjectTriggerBuildMixin, ProjectForm):
"""Advanced project option form."""
@@ -199,7 +198,6 @@ class Meta:
per_project_settings = (
'default_version',
'default_branch',
- 'privacy_level',
'analytics_code',
'show_version_warning',
'single_version',
diff --git a/readthedocs/rtd_tests/tests/test_project_forms.py b/readthedocs/rtd_tests/tests/test_project_forms.py
index 04d1b02b846..eb0ba4ef799 100644
--- a/readthedocs/rtd_tests/tests/test_project_forms.py
+++ b/readthedocs/rtd_tests/tests/test_project_forms.py
@@ -1,4 +1,5 @@
from unittest import mock
+
from django.contrib.auth.models import User
from django.test import TestCase
from django.test.utils import override_settings
@@ -6,11 +7,10 @@
from django_dynamic_fixture import get
from textclassifier.validators import ClassifierValidator
-from readthedocs.builds.constants import LATEST, STABLE, EXTERNAL
+from readthedocs.builds.constants import EXTERNAL, LATEST, STABLE
from readthedocs.builds.models import Version
from readthedocs.projects.constants import (
PRIVATE,
- PRIVACY_CHOICES,
PROTECTED,
PUBLIC,
REPO_TYPE_GIT,
@@ -274,28 +274,6 @@ def test_default_version_field_if_no_active_version(self):
self.assertTrue(form.fields['default_version'].widget.attrs['readonly'])
self.assertEqual(form.fields['default_version'].initial, 'latest')
- def test_hide_protected_privacy_level_new_objects(self):
- """
- Test PROTECTED is only allowed in old objects.
-
- New projects are not allowed to set the privacy level as protected.
- """
- # New default object
- project = get(Project)
- form = ProjectAdvancedForm(instance=project)
-
- privacy_choices = list(PRIVACY_CHOICES)
- privacy_choices.remove((PROTECTED, _('Protected')))
- self.assertEqual(form.fields['privacy_level'].choices, privacy_choices)
-
- # "Old" object with privacy_level previously set as protected
- project = get(
- Project,
- privacy_level=PROTECTED,
- )
- form = ProjectAdvancedForm(instance=project)
- self.assertEqual(form.fields['privacy_level'].choices, list(PRIVACY_CHOICES))
-
class TestProjectAdvancedFormDefaultBranch(TestCase):
diff --git a/readthedocs/templates/core/project_detail_right.html b/readthedocs/templates/core/project_detail_right.html
index 5b9395df09b..b47ad0c8e8d 100644
--- a/readthedocs/templates/core/project_detail_right.html
+++ b/readthedocs/templates/core/project_detail_right.html
@@ -97,15 +97,6 @@ {% trans "Tags" %}
{% endblock %}
-{% block privacy-level %}
- {% trans "Project Privacy Level" %}
-
-
- {{ project.get_privacy_level_display }}
-
-
-{% endblock %}
-
{% block short-urls %}
{% trans "Short URLs" %}
From b0cce7b49342213d7f53d4691c7f6c1fdf1d2eee Mon Sep 17 00:00:00 2001
From: Santos Gallegos
Date: Mon, 4 May 2020 15:09:25 -0500
Subject: [PATCH 02/10] Update docs about privacy
---
docs/privacy.rst | 36 ------------------------------------
docs/versions.rst | 20 ++++++++++++++++++++
2 files changed, 20 insertions(+), 36 deletions(-)
delete mode 100644 docs/privacy.rst
diff --git a/docs/privacy.rst b/docs/privacy.rst
deleted file mode 100644
index b1321558668..00000000000
--- a/docs/privacy.rst
+++ /dev/null
@@ -1,36 +0,0 @@
-Privacy Levels
-==============
-
-.. note::
- For private documentation or docs from private repositories,
- use :doc:`Read the Docs for Business `.
-
-Read the Docs supports 3 different privacy levels on 2 different objects;
-Public, Private on Projects and Versions.
-
-Understanding the Privacy Levels
---------------------------------
-
-+------------+------------+-----------+-----------+-------------+
-| Level | Detail | Listing | Search | Viewing |
-+============+============+===========+===========+=============+
-| Private | No | No | No | Yes |
-+------------+------------+-----------+-----------+-------------+
-| Public | Yes | Yes | Yes | Yes |
-+------------+------------+-----------+-----------+-------------+
-
-.. note:: With a URL to view the actual documentation, even private docs are viewable.
- This is because our architecture doesn't do any logic on documentation display,
- to increase availability.
-
-Public
-~~~~~~
-
-This is the easiest and most obvious. It is also the default.
-It means that everything is available to be seen by everyone.
-
-Private
-~~~~~~~
-
-Private objects are available only to people who have permissions to see them.
-They will not display on any list view, and will 404 when you link them to others.
diff --git a/docs/versions.rst b/docs/versions.rst
index afe0fbf490e..d4f3ba36df3 100644
--- a/docs/versions.rst
+++ b/docs/versions.rst
@@ -105,6 +105,26 @@ This is useful when:
Active versions that are hidden will be listed as ``Disallow: /path/to/version/``
in the default `robots.txt file `__ created by Read the Docs.
+Privacy levels
+--------------
+
+.. note::
+
+ Privacy levels are only supported on :doc:`Read the Docs for Business `.
+
+Public
+~~~~~~
+
+This is the easiest and most obvious.
+It means that everything is available to be seen by everyone.
+
+Private
+~~~~~~~
+
+Private objects are available only to people who have permissions to see them.
+They will not display on any list view, and will 404 when you link them to others.
+If you want to share your docs temporary, see :doc:`/commercial/sharing`.
+
Version warning
---------------
From 75bfecbd1d160e4e051d63c7ba98a662daeacbbf Mon Sep 17 00:00:00 2001
From: Santos Gallegos
Date: Mon, 4 May 2020 15:10:26 -0500
Subject: [PATCH 03/10] Typo
---
docs/versions.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/versions.rst b/docs/versions.rst
index d4f3ba36df3..9899cabe414 100644
--- a/docs/versions.rst
+++ b/docs/versions.rst
@@ -123,7 +123,7 @@ Private
Private objects are available only to people who have permissions to see them.
They will not display on any list view, and will 404 when you link them to others.
-If you want to share your docs temporary, see :doc:`/commercial/sharing`.
+If you want to share your docs temporarily, see :doc:`/commercial/sharing`.
Version warning
---------------
From 89e1ff02d5881b61fbc59507796d7803dbcdd027 Mon Sep 17 00:00:00 2001
From: Santos Gallegos
Date: Mon, 4 May 2020 15:17:57 -0500
Subject: [PATCH 04/10] Change object -> versions
---
docs/versions.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/versions.rst b/docs/versions.rst
index 9899cabe414..83ec1599613 100644
--- a/docs/versions.rst
+++ b/docs/versions.rst
@@ -121,7 +121,7 @@ It means that everything is available to be seen by everyone.
Private
~~~~~~~
-Private objects are available only to people who have permissions to see them.
+Private versions are available only to people who have permissions to see them.
They will not display on any list view, and will 404 when you link them to others.
If you want to share your docs temporarily, see :doc:`/commercial/sharing`.
From c1335ae0c77d8cad4badd0334cdf334292e3b334 Mon Sep 17 00:00:00 2001
From: Santos Gallegos
Date: Mon, 4 May 2020 15:21:45 -0500
Subject: [PATCH 05/10] Remove trailing whitespaces
---
docs/versions.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/versions.rst b/docs/versions.rst
index 83ec1599613..0074ddea9e7 100644
--- a/docs/versions.rst
+++ b/docs/versions.rst
@@ -98,7 +98,7 @@ any user with a link to its docs would be able to see it.
This is useful when:
- You no longer support a version, but you don't want to remove its docs.
-- You have a work in progress version and don't want to publish its docs just yet.
+- You have a work in progress version and don't want to publish its docs just yet.
.. note::
From fc3a270e37b2dfe5196b87f36b67e1ec370d87ad Mon Sep 17 00:00:00 2001
From: Santos Gallegos
Date: Tue, 5 May 2020 09:55:26 -0500
Subject: [PATCH 06/10] Update docs/versions.rst
Co-authored-by: Manuel Kaufmann
---
docs/versions.rst | 1 -
1 file changed, 1 deletion(-)
diff --git a/docs/versions.rst b/docs/versions.rst
index 0074ddea9e7..771577ec162 100644
--- a/docs/versions.rst
+++ b/docs/versions.rst
@@ -115,7 +115,6 @@ Privacy levels
Public
~~~~~~
-This is the easiest and most obvious.
It means that everything is available to be seen by everyone.
Private
From f274b6a2d26db9a352a9e63168d6fabb5bfd108f Mon Sep 17 00:00:00 2001
From: Santos Gallegos
Date: Wed, 6 May 2020 10:25:49 -0500
Subject: [PATCH 07/10] Remove privacy from index
---
docs/index.rst | 1 -
1 file changed, 1 deletion(-)
diff --git a/docs/index.rst b/docs/index.rst
index 0ccea91c2dc..cfb44eabeba 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -138,7 +138,6 @@ out of your documentation and Read the Docs.
subprojects
single_version
- privacy
localization
From 447ac8f913bf81eb2d4a9cc181fdcd384e065d50 Mon Sep 17 00:00:00 2001
From: Santos Gallegos
Date: Wed, 6 May 2020 10:59:48 -0500
Subject: [PATCH 08/10] Update docs
---
docs/index.rst | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/docs/index.rst b/docs/index.rst
index cfb44eabeba..7f5034393fa 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -111,8 +111,7 @@ out of your documentation and Read the Docs.
* **Advanced project configuration**:
:doc:`subprojects` |
- :doc:`Single version docs ` |
- :doc:`Privacy levels `
+ :doc:`Single version docs `
* **Multi-language documentation**:
:doc:`Translations and localization `
From c7fc7f197c1795d4330ddac01fdba90102cc06c4 Mon Sep 17 00:00:00 2001
From: Santos Gallegos
Date: Wed, 27 May 2020 09:46:41 -0500
Subject: [PATCH 09/10] Test is passing now
---
readthedocs/proxito/tests/test_middleware.py | 2 --
1 file changed, 2 deletions(-)
diff --git a/readthedocs/proxito/tests/test_middleware.py b/readthedocs/proxito/tests/test_middleware.py
index 2294563c6e1..61d3d4ec476 100644
--- a/readthedocs/proxito/tests/test_middleware.py
+++ b/readthedocs/proxito/tests/test_middleware.py
@@ -242,8 +242,6 @@ def setUp(self):
sys.modules['fake_urlconf'] = self.pip.proxito_urlconf
set_urlconf('fake_urlconf')
- # TODO: Figure out why this is failing in travis
- @pytest.mark.xfail(strict=True)
def test_middleware_urlconf_subproject(self):
resp = self.client.get('/subpath/subproject/testing/en/foodex.html', HTTP_HOST=self.domain)
self.assertEqual(resp.status_code, 200)
From 18d5778f02f5b389d75e26cd48d74f4b5020d292 Mon Sep 17 00:00:00 2001
From: Santos Gallegos
Date: Wed, 27 May 2020 10:20:44 -0500
Subject: [PATCH 10/10] Isn't passing now..
---
readthedocs/proxito/tests/test_middleware.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/readthedocs/proxito/tests/test_middleware.py b/readthedocs/proxito/tests/test_middleware.py
index 61d3d4ec476..2294563c6e1 100644
--- a/readthedocs/proxito/tests/test_middleware.py
+++ b/readthedocs/proxito/tests/test_middleware.py
@@ -242,6 +242,8 @@ def setUp(self):
sys.modules['fake_urlconf'] = self.pip.proxito_urlconf
set_urlconf('fake_urlconf')
+ # TODO: Figure out why this is failing in travis
+ @pytest.mark.xfail(strict=True)
def test_middleware_urlconf_subproject(self):
resp = self.client.get('/subpath/subproject/testing/en/foodex.html', HTTP_HOST=self.domain)
self.assertEqual(resp.status_code, 200)