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
QuerySets: remove unused overrides #8299
Conversation
With the aim to bring logic from .com to .org more closer I'm moving the organization's filters to .org. They are going to be used if `RTD_ALLOW_ORGANIZATIONS` is True, but they eventually will be merged with the current querysets when organizations and normal projects are supported in .org. In .com we are relying on user.projects having the the projects where the user is member of and organization owner (we are syncing this with signals). We don't rely on that hack anymore and always check from the organization models. The signals won't be removed for now, but shouldn't be needed anymore. To re-use more code I have brought the SSO concept here, but isn't implemented yet, we can bring the SSO models and logic later easily. This could be seen as more queries, but the main ones were already being executed in .com. The other ones are executed only when using the API V2, so I don't think that would be a problem. I started this refactor using a mixin, but then we would need to override every single queryset in .com, using composition only requires one override (already used), and doesn't bring other methods into the class.
7cbfe61
to
6cfa8e5
Compare
@@ -179,7 +179,6 @@ def get_queryset(self): | |||
queryset = super().get_queryset() | |||
queryset = ( | |||
queryset | |||
.internal() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are doing filtering per-version in
readthedocs.org/readthedocs/search/utils.py
Lines 28 to 31 in 2aa332b
queryset = ( | |
doc_obj.get_queryset() | |
.filter(project=version.project, version=version, build=build) | |
) |
6cfa8e5
to
4ce452d
Compare
We don't user these in .com
4ce452d
to
ee3eb2d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Let's merge this after we finish our conversation in #8298 to avoid mixing it with unrelated changes.
We don't user these in .com, this is on top of #8298