diff --git a/modules/behavior/hash.js b/modules/behavior/hash.js index daf5968aa..2e0723e5c 100644 --- a/modules/behavior/hash.js +++ b/modules/behavior/hash.js @@ -75,8 +75,13 @@ export function behaviorHash(context) { if (window.location.hash) { var q = utilStringQs(window.location.hash.substring(1)); - if (q.id) context.zoomToEntity(q.id.split(',')[0], !q.map); - if (q.comment) context.storage('comment', q.comment); + if (q.id) { + context.zoomToEntity(q.id.split(',')[0], !q.map); + } + if (q.comment) { + context.storage('comment', q.comment); + context.storage('commentDate', Date.now()); + } hashchange(); if (q.map) hash.hadHash = true; } diff --git a/modules/ui/commit.js b/modules/ui/commit.js index 531517657..4e1512b8e 100644 --- a/modules/ui/commit.js +++ b/modules/ui/commit.js @@ -41,7 +41,16 @@ export function uiCommit(context) { var changes = context.history().changes(), summary = context.history().difference().summary(), - rawTagEditor = uiRawTagEditor(context).on('change', changeTags); + rawTagEditor = uiRawTagEditor(context).on('change', changeTags), + comment = context.storage('comment') || '', + commentDate = +context.storage('commentDate') || 0, + currDate = Date.now(), + cutoff = 2 * 86400 * 1000; // 2 days + + // expire the stored comment if it is too old - #3947 + if (commentDate > currDate || currDate - commentDate > cutoff) { + comment = ''; + } selection .append('div') @@ -67,11 +76,12 @@ export function uiCommit(context) { .attr('class', 'commit-form-comment') .attr('placeholder', t('commit.description_placeholder')) .attr('maxlength', 255) - .property('value', context.storage('comment') || '') + .property('value', comment) .on('input.save', change(true)) .on('change.save', change()) .on('blur.save', function() { context.storage('comment', this.value); + context.storage('commentDate', Date.now()); });