mirror of
https://github.com/wassname/talk.git
synced 2026-09-12 13:01:11 +08:00
Rejecting comments on the server if the character count is too long.
This commit is contained in:
@@ -97,7 +97,13 @@ router.post('/', wordlist.filter('body'), (req, res, next) => {
|
||||
|
||||
// Return `premod` if pre-moderation is enabled and an empty "new" status
|
||||
// in the event that it is not in pre-moderation mode.
|
||||
.then(({moderation}) => moderation === 'pre' ? 'premod' : '');
|
||||
.then(({moderation, charCountEnable, charCount}) => {
|
||||
// Reject if the comment is too long
|
||||
if (charCountEnable && body.length > charCount) {
|
||||
return 'rejected';
|
||||
}
|
||||
return moderation === 'pre' ? 'premod' : '';
|
||||
});
|
||||
}
|
||||
|
||||
status.then((status) => Comment.publicCreate({
|
||||
|
||||
Reference in New Issue
Block a user