-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Allow to hide version warning #3595
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
Allow to hide version warning #3595
Conversation
da80e41
to
121cde5
Compare
I think the implementation that you propose here does the trick on disabling the warning, but is that what we want? For example, setting the
I don't know, I'm just thinking aloud. I know there are other issues related to this one that we may consider to find the general solution instead of a specific one as it is this one. We can continue discussing. For example #3547 Besides, in the issue there are other considerations like i18n and the text from the note itself. Finally, in case that we continue this direction, this shouldn't be added to the web interface but to the yaml as a config since the web interface it's kind on a deprecation status. |
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.
@stsewd Squash your commits into one it would be better! 😄
I'm marking this as |
A couple things:
|
I wrote a comment at #3481 (comment) that, if implemented, will cover this case. |
Closing then |
We had a discussion yesterday with the core team and we made a decision regarding this topic. Since we need a way to "solve" the problem that some project doesn't match our rules to decide whether to show the banner or not and we can't make those rules extemedely flexible, we decided:
Basically, this PR almost fits all the needings here and we will want to continue working on this. @stsewd would you like to wrap this PR and make it ready to be merged? |
@humitos sure
I'm don't understand this, isn't this should be the default behavior? I mean, this is one of the top features of rtd (at least I think so). |
Yes, it's a really good feature... when it works :) I mean, if the project's release rules matches our logic for the banner, it's a really good feature. Otherwise, it's annoying. So, the default value is arguable depending on the answer to "how many project we have where this is a feature" over "how many project we have where this is a problem", I'd say. Now, how do we get those numbers? I think the idea of making it default to |
121cde5
to
916381f
Compare
I'm not sure how to do that, this is done when applying the migration on the rtd servers? We don't have docs about this feature, so we can add them now, maybe here https://docs.readthedocs.io/en/latest/versions.html? |
Yes to both. For the migration, take a look at the django docs (I'm in the phone now) to see how to create a method that's executed when the migration is ran. You can test this locally in your instance first. For the docs, we should add it, yes. |
@humitos I was searching for those docs, I didn't find then maybe I even didn't know what was searching 😁. |
This is ready for review, I tested the data migration and works perfectly :) |
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.
This is almost ready to merge for me. I'll appreciate if you take a look at my comments and do the changes which are not huge.
Thanks!
docs/versions.rst
Outdated
--------------- | ||
|
||
This is the banner with the text *You are not using..* | ||
that is displayed on an unreleased version of your docs, |
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.
Is this banner displayed on latest
version? I suppose that it was displayed on old releases only.
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.
Yeah, my mistake
migrations.AddField( | ||
model_name='project', | ||
name='show_version_warning', | ||
field=models.BooleanField(default=False, help_text='Show warning banner in non-stable versions.', verbose_name='Show version warning'), |
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 think this is the only operation that we need in this PR.
The other are things that are missing. Anyway, I suppose it's safe to add them here since probably are just changes in the help_text
. Would you like to check why they are here by taking a look at the previous migrations and see the differences?
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.
Just found two things that are commented below, the rest are just help text updates
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 checking this.
BTW, I saw only one comment. The one about the validator. Which is the other one?
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.
|
||
def show_version_warning_to_existing_projects(apps, schema_editor): | ||
Project = apps.get_model('projects', 'Project') | ||
for project in Project.objects.all(): |
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.
Instead of looping for all the Projects (more than 80k), you should use the .update
method here which does only one db transaction.
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 was wondering how much time this would take on the rtd servers p:
migrations.AddField( | ||
model_name='project', | ||
name='show_version_warning', | ||
field=models.BooleanField(default=False, help_text='Show warning banner in non-stable versions.', verbose_name='Show version warning'), |
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.
in non-stable versions
I think this should be different since the banner isn't shown in the latest version also
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.
Yes, agree. Please, fix this in the model and 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.
Any suggestions? Maybe Show warning banner in old versions?
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 liked the "non-stable" since it's clear. Maybe:
Show warning banner in non-stable nor latest versions
What do you think?
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 wanna to avoid the nor
, but it's better than old versions
This is ready to be merge from my point of view. We will need to be careful when doing the deploy since we are going to be updating ALL the projects. So, before merging, maybe it worth that @agjohnson takes a quick look at it. Although, I don't want to keep blocking this for too much time. |
0778c8a
to
ad4e80e
Compare
I just rebase and rebuild the assets |
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. We will finally get some of the DB migrations that we've been missing in as well.
Merging this. Need to do the migration next week, but will be good to get this out. 🍾 |
Is there any way to set this setting in the |
@astrofog no, this is a global setting, you may want to use https://github.com/humitos/sphinx-version-warning |
@astrofrog let me know if you have any doubt with https://github.com/humitos/sphinx-version-warning or if it does not suit your needs. There are some examples and it's easy to setup and customize. |
Closes #1616
I added a boolean field to allow users hide the version warning (You are not using...). This option is per project, no per version.
This is a initial proposal, let me know if you are interested on adding this option.
Things that are missing:
Related feature #3547