Skip to content

Remove some feature flags #7846

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

Merged
merged 4 commits into from
Jan 20, 2021
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
5 changes: 1 addition & 4 deletions readthedocs/analytics/proxied_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from readthedocs.api.v2.permissions import IsAuthorizedToViewVersion
from readthedocs.core.unresolver import unresolve_from_request
from readthedocs.core.utils.extend import SettingsOverrideObject
from readthedocs.projects.models import Feature, Project
from readthedocs.projects.models import Project


class BaseAnalyticsView(APIView):
Expand Down Expand Up @@ -62,9 +62,6 @@ def get(self, request, *args, **kwargs):
# pylint: disable=no-self-use
def increase_page_view_count(self, request, project, version, absolute_uri):
"""Increase the page view count for the given project."""
if not absolute_uri or not project.has_feature(Feature.STORE_PAGEVIEWS):
return

unresolved = unresolve_from_request(request, absolute_uri)
if not unresolved:
return
Expand Down
11 changes: 0 additions & 11 deletions readthedocs/analytics/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,6 @@ def test_increase_page_view_count(self):
PageView.objects.all().count() == 0
), 'There\'s no PageView object created yet.'

# Without the feature flag, no PageView is created
self.client.get(self.url, HTTP_HOST=self.host)
assert (
PageView.objects.all().count() == 0
)

feature, _ = Feature.objects.get_or_create(
feature_id=Feature.STORE_PAGEVIEWS,
)
self.project.feature_set.add(feature)

# testing for yesterday
with mock.patch('readthedocs.analytics.tasks.timezone.now') as mocked_timezone:
mocked_timezone.return_value = self.yesterday
Expand Down
11 changes: 3 additions & 8 deletions readthedocs/doc_builder/backends/sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,10 @@ def build(self):
return cmd_ret.successful

def get_sphinx_cmd(self):
if self.project.has_feature(Feature.FORCE_SPHINX_FROM_VENV):
return (
self.python_env.venv_bin(filename='python'),
'-m',
'sphinx',
)
return (
'python',
self.python_env.venv_bin(filename='sphinx-build'),
self.python_env.venv_bin(filename='python'),
'-m',
'sphinx',
)

def sphinx_parallel_arg(self):
Expand Down
10 changes: 0 additions & 10 deletions readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1596,10 +1596,8 @@ def add_features(sender, **kwargs):
INDEX_FROM_HTML_FILES = 'index_from_html_files'
SEARCH_SUBPROJECTS_ON_DEFAULT_VERSION = 'search_subprojects_on_default_version'

FORCE_SPHINX_FROM_VENV = 'force_sphinx_from_venv'
LIST_PACKAGES_INSTALLED_ENV = 'list_packages_installed_env'
VCS_REMOTE_LISTING = 'vcs_remote_listing'
STORE_PAGEVIEWS = 'store_pageviews'
SPHINX_PARALLEL = 'sphinx_parallel'
USE_SPHINX_BUILDERS = 'use_sphinx_builders'
DEDUPLICATE_BUILDS = 'deduplicate_builds'
Expand Down Expand Up @@ -1726,10 +1724,6 @@ def add_features(sender, **kwargs):
),
),

(
FORCE_SPHINX_FROM_VENV,
_('Force to use Sphinx from the current virtual environment'),
),
(
LIST_PACKAGES_INSTALLED_ENV,
_(
Expand All @@ -1741,10 +1735,6 @@ def add_features(sender, **kwargs):
VCS_REMOTE_LISTING,
_('Use remote listing in VCS (e.g. git ls-remote) if supported for sync versions'),
),
(
STORE_PAGEVIEWS,
_('Store pageviews for this project'),
),
(
SPHINX_PARALLEL,
_('Use "-j auto" when calling sphinx-build'),
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/projects/views/private.py
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ def get_context_data(self, **kwargs):

def _is_enabled(self, project):
"""Should we show traffic analytics for this project?"""
return project.has_feature(Feature.STORE_PAGEVIEWS)
return True
Comment on lines 1132 to +1134
Copy link
Member

Choose a reason for hiding this comment

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

Is this method overwritten in commercial taking into account the plan?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep



class TrafficAnalyticsView(SettingsOverrideObject):
Expand Down
3 changes: 2 additions & 1 deletion readthedocs/rtd_tests/tests/test_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ def test_build(self, load_config):
self.assertEqual(self.mocks.popen.call_count, 1)
cmd = self.mocks.popen.call_args_list[0][0]
self.assertRegex(cmd[0][0], r'python')
self.assertRegex(cmd[0][1], r'sphinx-build')
self.assertRegex(cmd[0][1], '-m')
self.assertRegex(cmd[0][2], 'sphinx')

@mock.patch('readthedocs.doc_builder.config.load_config')
def test_build_respects_pdf_flag(self, load_config):
Expand Down
7 changes: 0 additions & 7 deletions readthedocs/rtd_tests/tests/test_footer.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,6 @@ def setUp(self):
)
self.host = 'pip.readthedocs.io'

# Run tests with all available features
# that can increase the number of queries.
feature, _ = Feature.objects.get_or_create(
feature_id=Feature.STORE_PAGEVIEWS,
)
self.pip.feature_set.add(feature)

def test_version_queries(self):
with self.assertNumQueries(self.EXPECTED_QUERIES):
response = self.client.get(self.url, HTTP_HOST=self.host)
Expand Down