mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-17 22:10:23 +01:00
fix: pass length to messaging checkContent hook
This commit is contained in:
@@ -22,12 +22,13 @@ module.exports = function (Messaging) {
|
||||
}
|
||||
|
||||
const maximumChatMessageLength = meta.config.maximumChatMessageLength || 1000;
|
||||
const data = await plugins.fireHook('filter:messaging.checkContent', { content: content });
|
||||
content = String(data.content).trim();
|
||||
content = String(content).trim();
|
||||
let length = String(content.length).trim();
|
||||
({ content, length } = await plugins.fireHook('filter:messaging.checkContent', { content, length }));
|
||||
if (!content) {
|
||||
throw new Error('[[error:invalid-chat-message]]');
|
||||
}
|
||||
if (content.length > maximumChatMessageLength) {
|
||||
if (length > maximumChatMessageLength) {
|
||||
throw new Error('[[error:chat-message-too-long, ' + maximumChatMessageLength + ']]');
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user