Skip to content

Node.js based forum software built for the modern web

feat: add hook into user.posts.isReady

Barış Soner Uşaklı7207814b9087
diff --git a/src/user/posts.js b/src/user/posts.js
index 5ee7f5e8aa..318718f1c0 100644
--- a/src/user/posts.js
+++ b/src/user/posts.js
@@ -3,6 +3,7 @@
const db = require('../database');
const meta = require('../meta');
const privileges = require('../privileges');
+const plugins = require('../plugins');
const groups = require('../groups');
module.exports = function (User) {
@@ -48,6 +49,18 @@ module.exports = function (User) {
await User.checkMuted(uid);
+ const { shouldIgnoreDelays } = await plugins.hooks.fire('filter:user.posts.isReady', {
+ shouldIgnoreDelays: false,
+ user: userData,
+ cid,
+ field,
+ isAdminOrMod,
+ isMemberOfExempt,
+ });
+ if (shouldIgnoreDelays) {
+ return;
+ }
+
const now = Date.now();
if (now - userData.joindate < meta.config.initialPostDelay * 1000) {
throw new Error(`[[error:user-too-new, ${meta.config.initialPostDelay}]]`);