fix signup-ctas blocking render

This commit is contained in:
Nick Sweeting 2021-05-19 00:43:08 -04:00 committed by GitHub
parent 46381fd516
commit 1e7efe3d98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,12 +31,12 @@ module.exports = function(state, emit) {
counts, counts,
num => state.translate('downloadCount', { num }), num => state.translate('downloadCount', { num }),
value => { value => {
const max = state.user.maxDownloads; const selected = parseInt(value);
state.archive.dlimit = Math.min(value, max); state.archive.dlimit = selected;
if (value > max) { emit('render');
if (selected > parseInt(state.user.maxDownloads || '0')) {
console.log('Chosen max download count is larger than the allowed limit for anonymous users', selected)
emit('signup-cta', 'count'); emit('signup-cta', 'count');
} else {
emit('render');
} }
}, },
'expire-after-dl-count-select' 'expire-after-dl-count-select'
@ -58,12 +58,12 @@ module.exports = function(state, emit) {
return state.translate(l10n.id, l10n); return state.translate(l10n.id, l10n);
}, },
value => { value => {
const max = state.user.maxExpireSeconds; const selected = parseInt(value);
state.archive.timeLimit = Math.min(value, max); state.archive.timeLimit = selected;
if (value > max) { emit('render');
if (selected > parseInt(state.user.maxExpireSeconds || '0')) {
console.log('Chosen download expiration is larger than the allowed limit for anonymous users', selected)
emit('signup-cta', 'time'); emit('signup-cta', 'time');
} else {
emit('render');
} }
}, },
'expire-after-time-select' 'expire-after-time-select'