don't render expired uploads

This commit is contained in:
Danny Coates 2018-11-16 12:30:15 -08:00
parent 9989f944c3
commit 32a55d00b2
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
3 changed files with 26 additions and 12 deletions

View file

@ -184,8 +184,17 @@ async function streamToArrayBuffer(stream, size) {
}
function list(items, ulStyle = '', liStyle = '') {
const lis = items.map(i => html`<li class="${liStyle}">${i}</li>`);
return html`<ul class="${ulStyle}">${lis}</ul>`;
const lis = items.map(
i =>
html`
<li class="${liStyle}">${i}</li>
`
);
return html`
<ul class="${ulStyle}">
${lis}
</ul>
`;
}
function secondsToL10nId(seconds) {
@ -199,6 +208,9 @@ function secondsToL10nId(seconds) {
}
function timeLeft(milliseconds) {
if (milliseconds < 1) {
return { id: 'linkExpiredAlt' };
}
const minutes = Math.floor(milliseconds / 1000 / 60);
const hours = Math.floor(minutes / 60);
const days = Math.floor(hours / 24);