Node.js based forum software built for the modern web
feat: closes #12052, ability to disable stale topic warning
Barış Soner Uşaklıf8a3aceb5396
diff --git a/public/language/en-GB/admin/settings/post.json b/public/language/en-GB/admin/settings/post.jsonindex 9dc61afe57..9de7dc76fa 100644--- a/public/language/en-GB/admin/settings/post.json+++ b/public/language/en-GB/admin/settings/post.json@@ -27,7 +27,7 @@"restrictions.title-length": "Title Length","restrictions.post-length": "Post Length","restrictions.days-until-stale": "Days until topic is considered stale",- "restrictions.stale-help": "If a topic is considered \"stale\", then a warning will be shown to users who attempt to reply to that topic.",+ "restrictions.stale-help": "If a topic is considered \"stale\", then a warning will be shown to users who attempt to reply to that topic. (set to 0 to disable)","timestamp": "Timestamp","timestamp.cut-off": "Date cut-off (in days)","timestamp.cut-off-help": "Dates & times will be shown in a relative manner (e.g. \"3 hours ago\" / \"5 days ago\"), and localised into various\n\t\t\t\t\tlanguages. After a certain point, this text can be switched to display the localised date itself\n\t\t\t\t\t(e.g. 5 Nov 2016 15:30).<br /><em>(Default: <code>30</code>, or one month). Set to 0 to always display dates, leave blank to always display relative times.</em>",diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.jsindex e8b6b17970..573ffe4441 100644--- a/public/src/client/topic/postTools.js+++ b/public/src/client/topic/postTools.js@@ -431,7 +431,14 @@ define('forum/topic/postTools', [}function showStaleWarning(callback) {- const staleThreshold = Math.min(Date.now() - (1000 * 60 * 60 * 24 * ajaxify.data.topicStaleDays), 8640000000000000);+ const topicStaleDays = parseInt(ajaxify.data.topicStaleDays, 10);+ if (!topicStaleDays) {+ return callback();+ }+ const staleThreshold = Math.min(+ Date.now() - (1000 * 60 * 60 * 24 * ajaxify.data.topicStaleDays),+ 8640000000000000+ );if (staleReplyAnyway || ajaxify.data.lastposttime >= staleThreshold) {return callback();}