mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
Create links to users profile in chat messages
This commit is contained in:
@@ -18,6 +18,7 @@ import guildsAllowingBannedWords from '../../libs/guildsAllowingBannedWords';
|
||||
import { getMatchesByWordArray } from '../../libs/stringUtils';
|
||||
import bannedSlurs from '../../libs/bannedSlurs';
|
||||
import apiError from '../../libs/apiError';
|
||||
import {highlightMentions} from '../../libs/highlightMentions';
|
||||
|
||||
const FLAG_REPORT_EMAILS = nconf.get('FLAG_REPORT_EMAIL').split(',').map((email) => {
|
||||
return { email, canSend: true };
|
||||
@@ -175,7 +176,8 @@ api.postChat = {
|
||||
throw new NotAuthorized(res.t('messageGroupChatSpam'));
|
||||
}
|
||||
|
||||
const newChatMessage = group.sendChat(req.body.message, user);
|
||||
const message = await highlightMentions(req.body.message);
|
||||
const newChatMessage = group.sendChat(message, user);
|
||||
let toSave = [newChatMessage.save()];
|
||||
|
||||
if (group.type === 'party') {
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
} from '../../libs/email';
|
||||
import { sendNotification as sendPushNotification } from '../../libs/pushNotifications';
|
||||
import { achievements } from '../../../../website/common/';
|
||||
import {highlightMentions} from '../../libs/highlightMentions';
|
||||
|
||||
let api = {};
|
||||
|
||||
@@ -632,7 +633,7 @@ api.sendPrivateMessage = {
|
||||
if (validationErrors) throw validationErrors;
|
||||
|
||||
const sender = res.locals.user;
|
||||
const message = req.body.message;
|
||||
const message = await highlightMentions(req.body.message);
|
||||
const receiver = await User.findById(req.body.toUserId).exec();
|
||||
if (!receiver) throw new NotFound(res.t('userNotFound'));
|
||||
if (!receiver.flags.verifiedUsername) delete receiver.auth.local.username;
|
||||
|
||||
Reference in New Issue
Block a user