-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Display warning banner in latest version #3547
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
Conversation
Now the highest version is only for the latest version, stable isn't considered highest.
I need to update the tests |
@@ -26,7 +26,8 @@ def get_version_compare_data(project, base_version=None): | |||
Retrieve metadata about the highest version available for this project. | |||
|
|||
:param base_version: We assert whether or not the base_version is also the | |||
highest version in the resulting "is_highest" value. | |||
highest version in the resulting "is_highest" value | |||
or the stabel version in "is_stable". |
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.
Little typo "stabel" -> "stable"
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.
Thanks for your contribution!
I think this is a good improvement.
It changes a little the old logic since RTD was sending all the people to read the most updated unreleased documentation and now RTD will be sending people to read the "latest stable" release. I personally think that it's a good improvement and it's the proper direction but I wanted to mention this in case that other people find this inapropiated for some reason (that I'd like to listen)
Finally, I left two comments to consider and discuss a little.
} | ||
if highest_version_obj: | ||
ret_val['url'] = highest_version_obj.get_absolute_url() | ||
ret_val['slug'] = (highest_version_obj.slug,) | ||
if base_version and base_version.slug == STABLE: | ||
ret_val['is_highest'] = False | ||
ret_val['is_stable'] = True |
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 not really following the whole flow, but supposing this case:
base_version
is the STABLE- we get a
highest_version_obj
we end up returning a is_stable
in True
but with the url
and slug
from another version?
(I'm asking because I'm a little confused here)
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.
Well, I'm confused too p: but looking to the docstring, says:
Retrieve metadata about the highest version available for this project.
So, always return that information about the highest. And when base_version
is given, is_stable
and is_highest
are for that version. I think that method needs refactoring.
And I realized that when I enter to stable version manually (docs/2018 instead of docs/stable in my example) the message appears, I need to check that case.
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.
After looking deeper into the code, I found that highest
== stable
, or at least the function return the mayor version (except for latest, stable) of the project.
@humitos can you confirm that? In that case, we need to add some field is_latest
, no is_stable
, or keep the names of the current PR and change the logic (I'm not sure if this breaks other part of the code that uses the API).
return; | ||
} | ||
|
||
var message = 'You are not using the most up to date version of the library.'; | ||
if (data.is_highest) { | ||
message = 'You are not using the stable version of the library.'; |
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.
Somewhere I read that @ericholscher used the word "unreleased" here instead and I liked.
I think it's clearer to use a sentence like,
You are using an unreleased version of this library
Going deeper on this (maybe in another PR focusing more on this), words like "library" and "using" don't make too much sense for all type of documentation that RTD hosts. Maybe changing them to "documentation" and "reading" are more general.
You are reading an unreleased version of this documentation
What do you think?
Example from Django docs,
This document is for Django's development version, which can be significantly different from previous releases. For older releases, use the version selector floating in the bottom right corner of this page.
https://docs.djangoproject.com/en/dev/intro/tutorial01/
I also like the "tip" saying where you can find the other versions. I'd like to go in that direction, but I'm not sure how to write a good English sentence for this, @RichardLitt want to help us?
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.
You are reading an unreleased version of this documentation
I was thinking the same, the word documentation makes more sense here.
Also, we are missing some i18n on this message, I'm not sure how relevant is that for now.
About the tip, I think would be a little confusing, since the position of the version selector change according to the theme (some times is on the left and others floating to the right), and we asre already providing a link to go to the stable version.
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.
Also, we are missing some i18n on this message, I'm not sure how relevant is that for now.
Good point! I think it's relevant, but I'd say to open another issue to track this. I don't know how we are handling i18n in Javascript. Did you see other parts in the code?
About the tip, I think would be a little confusing [...]
Yeah, you are right. I think there is no generic way to point the users to the right place.
I wrote a comment at #3481 (comment) that, if implemented, will cover this case in a general sense. |
@stsewd thoughts here? Is this still something we should do? I'm not sure.. |
I think with #3595 this was solved |
ReadTheDocs still doesn't display warning banner in |
No, we don't display the banner in the latest version, but on the "latest stable" version |
@stsewd I meant that currently this is readthedocs.org's behavior (assuming 1.0.1 is the "latest stable" version):
While this PR would change it to something like this:
Having such warning in Edit: I did read this comment though so this would probably need to not be as simple as this PR and it should be possible to disable such behavior (and customize message shown?). This is just the most suitable place that I was able to find about the mentioned change of behavior. |
@jack1142 you can use this extension to have more control over which versions the banner is shown https://github.com/humitos/sphinx-version-warning |
Closes #3481 and probably solves #1644
I introduced a new field in the API response:
is_stable
, to indicate if the given version is stable.Now the highest version is only for the latest version, stable isn't considered highest anymore.
On stable version
On latest version
On old version