mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	feat: closes #12052, ability to disable stale topic warning
This commit is contained in:
		| @@ -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 & 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 & 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>", | ||||||
|   | |||||||
| @@ -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(); | ||||||
| 		} | 		} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user