-
Notifications
You must be signed in to change notification settings - Fork 245
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
Fix month calculation to 30 days, and add no expiry and year as expiry options #49
Conversation
Sorry for closing and re-opening the PR (it was a mis-click) |
Seems that you also need to modify the corresponding tests |
Done |
@@ -127,7 +127,7 @@ test("expire", async () => { | |||
await testExpireParse("100m", 6000) | |||
await testExpireParse("100h", 360000) | |||
await testExpireParse("1d", 86400) | |||
await testExpireParse("1M", 18144000) | |||
await testExpireParse("1M", 2592000) | |||
await testExpireParse("100 m", 6000) |
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.
We also need tests on Y
and empty expiration, considering changes in parseExpiration()
frontend/index.html
Outdated
@@ -43,7 +43,7 @@ <h2>Settings</h2> | |||
<div id='paste-expiration-panel' class='paste-setting-subitem-panel'> | |||
<input list='expiration-choices' type='text' min='60' step='1' name='paste-expiration' | |||
id='paste-expiration-input' placeholder='Expiration (secs)' value='7d'> | |||
<label class='small-label' for='paste-expiration-input'>Delete your paste after a period of time. <br>Units: s (seconds), m (minutes), h (hours), d (days), M (months)</label> | |||
<label class='small-label' for='paste-expiration-input'>Delete your paste after a period of time (leave blank for no expiry). <br>Units: s (seconds), m (minutes), h (hours), d (days), M (months), Y (years) <br> Max 68 years</label> |
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.
Max 68 years
could be omitted since I don't think the service can live so long and I prefer the label to be as concise as possible.
frontend/index.client.js
Outdated
@@ -83,7 +83,10 @@ window.addEventListener('DOMContentLoaded', () => { | |||
const pasteNotEmpty = inputType === 'edit' | |||
? pasteEditArea.prop('value').length > 0 | |||
: file !== null | |||
const expirationValid = EXPIRE_REGEX.test(expiration) // TODO: verify it | |||
expirationValid = EXPIRE_REGEX.test(expiration) // TODO: verify 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.
Use let
, no implicit declaration
Add tests for expiration in years and no expiry
Fixes #47, Resolves #48