mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
* Adding code to look over the most recent messages to look for spam from a user * Adding in translatable error message * Adding 2 tests for spam detection * Fixing changes requested for pull request * Adding unit tests for group and fixing requested changes * Fixing message and tests * Forgot to remove this import * Fixing lint errors * Cleaning up the code and tests to be more readable * Fixing lint errors * Fixed linting issues * Syntax fixes * Updated grammar
This commit is contained in:
@@ -153,6 +153,10 @@ api.postChat = {
|
||||
let lastClientMsg = req.query.previousMsg;
|
||||
chatUpdated = lastClientMsg && group.chat && group.chat[0] && group.chat[0].id !== lastClientMsg ? true : false;
|
||||
|
||||
if (group.checkChatSpam(user)) {
|
||||
throw new NotAuthorized(res.t('messageGroupChatSpam'));
|
||||
}
|
||||
|
||||
let newChatMessage = group.sendChat(req.body.message, user);
|
||||
|
||||
let toSave = [group.save()];
|
||||
|
||||
Reference in New Issue
Block a user