diff --git a/public/language/en_GB/topic.json b/public/language/en_GB/topic.json index a03ec807de..ab2031be4d 100644 --- a/public/language/en_GB/topic.json +++ b/public/language/en_GB/topic.json @@ -115,5 +115,7 @@ "oldest_to_newest": "Oldest to Newest", "newest_to_oldest": "Newest to Oldest", "most_votes": "Most votes", - "most_posts": "Most posts" + "most_posts": "Most posts", + + "stale_topic_warning": "The topic you are replying to is quite old. Would you like to create a new topic instead, and reference this one in your reply?" } diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.js index b3f6ebace2..dceb9fe421 100644 --- a/public/src/client/topic/postTools.js +++ b/public/src/client/topic/postTools.js @@ -135,6 +135,10 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator } function onReplyClicked(button, tid, topicName) { + if (ajaxify.data.lastposttime < (Date.now() - (1000*60*60*24*config.topicStaleDays))) { + return showStaleWarning(); + } + var selectionText = '', selection = window.getSelection ? window.getSelection() : document.selection.createRange(); @@ -170,6 +174,10 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator } function onQuoteClicked(button, tid, topicName) { + if (ajaxify.data.lastposttime < (Date.now() - (1000*60*60*24*config.topicStaleDays))) { + return showStaleWarning(); + } + var username = getUserName(button), pid = getData(button, 'data-pid'); @@ -379,5 +387,17 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator return false; } + function showStaleWarning() { + translator.translate('[[topic:stale_topic_warning]]', function(translated) { + bootbox.confirm(translated, function(create) { + if (create) { + $(window).trigger('action:composer.topic.new', { + cid: ajaxify.data.cid + }); + } + }); + }); + } + return PostTools; }); diff --git a/src/controllers/api.js b/src/controllers/api.js index 857f037635..56308ef535 100644 --- a/src/controllers/api.js +++ b/src/controllers/api.js @@ -41,6 +41,7 @@ apiController.getConfig = function(req, res, next) { config.maximumTitleLength = meta.config.maximumTitleLength; config.minimumPostLength = meta.config.minimumPostLength; config.maximumPostLength = meta.config.maximumPostLength; + config.topicStaleDays = parseInt(meta.config.topicStaleDays, 10) || 60; config.hasImageUploadPlugin = plugins.hasListeners('filter:uploadImage'); config.maximumProfileImageSize = meta.config.maximumProfileImageSize; config.minimumUsernameLength = meta.config.minimumUsernameLength; diff --git a/src/views/admin/settings/post.tpl b/src/views/admin/settings/post.tpl index 833b98fd6f..84f2772086 100644 --- a/src/views/admin/settings/post.tpl +++ b/src/views/admin/settings/post.tpl @@ -29,40 +29,48 @@
- - + +
- - + +
- - + +
- - + +
- - + +
- - + +
- - + +
- - + +
- - + + +
+
+ + +

+ If a topic is considered "stale", then a warning will be shown to users who attempt to reply + to that topic. +