mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 05:37:22 +01:00
Fix username links resulting in truncated chat messages (#11945)
* introduce MAX_MESSAGE_LENGTH constant * add test * fix path * fix and tests * fix typo in tests
This commit is contained in:
@@ -2,7 +2,10 @@ import nconf from 'nconf';
|
||||
import { authWithHeaders } from '../../middlewares/auth';
|
||||
import { model as Group } from '../../models/group';
|
||||
import { model as User } from '../../models/user';
|
||||
import { chatModel as Chat } from '../../models/message';
|
||||
import {
|
||||
chatModel as Chat,
|
||||
sanitizeText as sanitizeMessageText,
|
||||
} from '../../models/message';
|
||||
import common from '../../../common';
|
||||
import {
|
||||
BadRequest,
|
||||
@@ -187,7 +190,8 @@ api.postChat = {
|
||||
throw new NotAuthorized(res.t('messageGroupChatSpam'));
|
||||
}
|
||||
|
||||
const [message, mentions, mentionedMembers] = await highlightMentions(req.body.message);
|
||||
const sanitizedMessageText = sanitizeMessageText(req.body.message);
|
||||
const [message, mentions, mentionedMembers] = await highlightMentions(sanitizedMessageText);
|
||||
let client = req.headers['x-client'] || '3rd Party';
|
||||
if (client) {
|
||||
client = client.replace('habitica-', '');
|
||||
|
||||
Reference in New Issue
Block a user