-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Page views: use origin URL instead of page name #7293
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f9ce9ca
Page views: use origin URL instead of page name
stsewd c27e4df
Fix test
stsewd d267903
Add unresolve_from_request
stsewd 70ad4b8
Use unresolve_from_request
stsewd 65fcc7c
Update tests
stsewd 2e5aa58
Fix tests
stsewd 552becc
Typo
stsewd b726251
Merge branch 'master' into page-views
stsewd 7a18594
Rename origin -> absolute_uri
stsewd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
from readthedocs.builds.models import Version | ||
from readthedocs.core.utils.extend import SettingsOverrideObject | ||
from readthedocs.projects.constants import MKDOCS, SPHINX_HTMLDIR | ||
from readthedocs.projects.models import Project, Feature | ||
from readthedocs.projects.models import Feature, Project | ||
from readthedocs.projects.version_handling import ( | ||
highest_version, | ||
parse_version_failsafe, | ||
|
@@ -81,6 +81,19 @@ class BaseFooterHTML(APIView): | |
""" | ||
Render and return footer markup. | ||
|
||
Query parameters: | ||
|
||
- project | ||
- version | ||
- page: Sphinx's page name, used for path operations, | ||
like change between languages (deprecated in favor of ``origin``). | ||
- origin: Full path with domain, used for path operations. | ||
- theme: Used to decide how to integrate the flyout menu. | ||
- docroot: Path where all the source documents are. | ||
Used to build the ``edit_on`` URL. | ||
- source_suffix: Suffix from the source document. | ||
Used to build the ``edit_on`` URL. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are passing subproject too, but we are not using it. I can remove it in another PR if that's ok |
||
|
||
.. note:: | ||
|
||
The methods `_get_project` and `_get_version` | ||
|
@@ -228,7 +241,8 @@ def get(self, request, format=None): | |
sender=None, | ||
request=request, | ||
context=context, | ||
resp_data=resp_data, | ||
response_data=resp_data, | ||
origin=self.request.GET.get('origin'), | ||
) | ||
|
||
return Response(resp_data) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why don't we call it
full_path
?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.
or
absolute_uri
as Django calls it when it has the domain on it.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.
I'm avoiding naming this path since it includes the domain as well, we use full path to refer to a path in other parts of the code. Not sure about uri
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.
Yea, origin isn't the right name, since that's used in HTTP for just the origin hostname: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin
I think
absolute_uri
or similar is best: https://docs.djangoproject.com/en/3.1/ref/request-response/#django.http.HttpRequest.build_absolute_uri