diff --git a/tildes/static/js/behaviors/comment-reply-button.js b/tildes/static/js/behaviors/comment-reply-button.js index 0f94ad4..72f59a6 100644 --- a/tildes/static/js/behaviors/comment-reply-button.js +++ b/tildes/static/js/behaviors/comment-reply-button.js @@ -79,6 +79,20 @@ $.onmount("[data-js-comment-reply-button]", function() { } } + var originalCommentTimestamp = new Date( + $parentComment + .find(".comment-header time") + .first() + .attr("datetime") + ); + if (Date.now() - originalCommentTimestamp > 1000 * 3600 * 24 * 62) { + var warningDiv = document.createElement("div"); + warningDiv.classList.add("toast"); + warningDiv.innerHTML = + "The comment you're replying to is over two months old. Are you sure you want to continue?"; + clone.querySelector("form").prepend(warningDiv); + } + // update Intercooler so it knows about this new form Intercooler.processNodes(clone); diff --git a/tildes/tildes/templates/topic.jinja2 b/tildes/tildes/templates/topic.jinja2 index 73c4697..4816c31 100644 --- a/tildes/tildes/templates/topic.jinja2 +++ b/tildes/tildes/templates/topic.jinja2 @@ -213,6 +213,9 @@ data-js-prevent-double-submit data-js-confirm-leave-page-unsaved > + {% if old_topic_warning %} +