feat: closes #12052, ability to disable stale topic warning

This commit is contained in:
Barış Soner Uşaklı
2023-10-02 11:34:54 -04:00
parent a71378cbb7
commit f8a3aceb53
2 changed files with 9 additions and 2 deletions

View File

@@ -27,7 +27,7 @@
"restrictions.title-length": "Title Length", "restrictions.title-length": "Title Length",
"restrictions.post-length": "Post Length", "restrictions.post-length": "Post Length",
"restrictions.days-until-stale": "Days until topic is considered stale", "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": "Timestamp",
"timestamp.cut-off": "Date cut-off (in days)", "timestamp.cut-off": "Date cut-off (in days)",
"timestamp.cut-off-help": "Dates &amp; 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>", "timestamp.cut-off-help": "Dates &amp; 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>",

View File

@@ -431,7 +431,14 @@ define('forum/topic/postTools', [
} }
function showStaleWarning(callback) { 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) { if (staleReplyAnyway || ajaxify.data.lastposttime >= staleThreshold) {
return callback(); return callback();
} }