Skip to content

Node.js based forum software built for the modern web

feat: add new lang string for minutes

Barış Soner Uşaklıd8d26c9f5732
diff --git a/public/language/en-GB/error.json b/public/language/en-GB/error.json
index a01bdb473a..5fbc1bfb14 100644
--- a/public/language/en-GB/error.json
+++ b/public/language/en-GB/error.json
@@ -104,6 +104,7 @@
"category-not-selected": "Category not selected.",
"too-many-posts": "You can only post once every %1 second(s) - please wait before posting again",
"too-many-posts-newbie": "As a new user, you can only post once every %1 second(s) until you have earned %2 reputation - please wait before posting again",
+ "too-many-posts-newbie-minutes": "As a new user, you can only post once every %1 minute(s) until you have earned %2 reputation - please wait before posting again",
"already-posting": "You are already posting",
"tag-too-short": "Please enter a longer tag. Tags should contain at least %1 character(s)",
"tag-too-long": "Please enter a shorter tag. Tags can't be longer than %1 character(s)",
diff --git a/src/user/posts.js b/src/user/posts.js
index 26b0f348bf..b2e2b57be2 100644
--- a/src/user/posts.js
+++ b/src/user/posts.js
@@ -58,7 +58,11 @@ module.exports = function (User) {
meta.config.newbiePostDelayThreshold > userData.reputation &&
now - lasttime < meta.config.newbiePostDelay * 1000
) {
- throw new Error(`[[error:too-many-posts-newbie, ${meta.config.newbiePostDelay}, ${meta.config.newbiePostDelayThreshold}]]`);
+ if (meta.config.newbiewPostDelay % 60 === 0) {
+ throw new Error(`[[error:too-many-posts-newbie-minutes, ${Math.floor(meta.config.newbiePostDelay / 60)}, ${meta.config.newbiePostDelayThreshold}]]`);
+ } else {
+ throw new Error(`[[error:too-many-posts-newbie, ${meta.config.newbiePostDelay}, ${meta.config.newbiePostDelayThreshold}]]`);
+ }
} else if (now - lasttime < meta.config.postDelay * 1000) {
throw new Error(`[[error:too-many-posts, ${meta.config.postDelay}]]`);
}