-
Notifications
You must be signed in to change notification settings - Fork 225
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
Expirarion Update #149
Comments
Confusingly, this even returns an already expired |
I believe the history here is the https://github.com/jpmcgrath/shortener#label-Fresh+Links Then the Right now you can, with one call:
But you cannot get link if it exists, and update date the expiry if it exists, all in a single call. If someone provides a new A workaround here is to do a second step to update the expiry date of your shortened url. ActiveRecord should prevent DB activity when it is not required (e.g. if you provide the same expiry date as was set on a newly generated record). As for a "fix", I am reluctant to change the existing behaviour now, as people may have come to rely on the current behaviour as a feature. @fschwahn suggestion of a new option could work, or perhaps a configuration option. |
@jpmcgrath what about adding a new feature flag on the generate function, that will be false by default, and it will refresh existing exires_at if exists |
when generating a shortened URL for the same link, and sending a new expiration date, it doesn't update the expiration.
example:
generate a link today, with 6.month.from_now expiration date with :
shortened_url = Shortener::ShortenedUrl.generate(url, expires_at: 6.month.from_now)
then in 3 months, generate the same link, with the exact same code:
shortened_url = Shortener::ShortenedUrl.generate(url, expires_at: 6.month.from_now)
expectation - expiration would be updated.
important to note - I don't know that the link already exists, but I do want to get the same shortened link. is it on purpose? any way around it?
The text was updated successfully, but these errors were encountered: