forked from torchbox/wagtaildraftsharing
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Support custom max age + multiple links per Revision #7
Merged
Conversation
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
stevejalim
commented
Dec 3, 2024
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.
Self review: r+
This avoids the downside of reusing links: you might get a link that will expire soon (or has expired but won't be marked as such until it's used)
…s generating a new one
3587d92
to
c17d3cd
Compare
stevejalim
commented
Dec 4, 2024
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.
Self review again: r+
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This changeset addresses some practical-usability issues with the project.
It allows more than one sharing link to exist per
Revision
. This is to provide a way to avoid requesting a sharing link only to be given one that may shortly expire or - worse - one which technically has expired but will only be marked as such when it is next accessed. Neither situation is ideal, so we provide a way to make an all-new link (at the Python level - for now the UI still tries to reuse an existing link if one exists).It gives us more control over link expiry beyond the 'one size fits all' approach of having it as a project-wide setting. Now, it's possible to pass in a number of seconds as
max_age
when callingWagtaildraftsharingLink.objects.get_or_create_for_revision
to set the expiry time of the link (or-1
to have no expiry at all)It refactors the settings to be a dictionary (based on how they're done in
mozilla/wagtail-localize-smartling
), making them easier to manage in a busy project. THIS IS A BREAKING CHANGEResolves #5
Resolves #6