fix: Improve mentions behavior

This commit is contained in:
Maksim Eltyshev
2025-08-11 13:52:17 +02:00
parent cbb00d1d59
commit 6515877eb6
9 changed files with 89 additions and 30 deletions

View File

@@ -6,12 +6,12 @@
const escapeMarkdown = require('escape-markdown');
const escapeHtml = require('escape-html');
const { extractMentionIds, formatTextWithMentions } = require('../../../utils/mentions');
const { extractMentionIds, mentionMarkupToText } = require('../../../utils/mentions');
const buildAndSendNotifications = async (services, board, card, comment, actorUser, t) => {
const markdownCardLink = `[${escapeMarkdown(card.name)}](${sails.config.custom.baseUrl}/cards/${card.id})`;
const htmlCardLink = `<a href="${sails.config.custom.baseUrl}/cards/${card.id}}">${escapeHtml(card.name)}</a>`;
const commentText = _.truncate(formatTextWithMentions(comment.text));
const commentText = _.truncate(mentionMarkupToText(comment.text));
await sails.helpers.utils.sendNotifications(services, t('New Comment'), {
text: `${t(
@@ -101,10 +101,9 @@ module.exports = {
if (mentionUserIds.length > 0) {
const boardMemberUserIds = await sails.helpers.boards.getMemberUserIds(inputs.board.id);
mentionUserIds = _.difference(
_.intersection(mentionUserIds, boardMemberUserIds),
mentionUserIds = _.difference(_.intersection(mentionUserIds, boardMemberUserIds), [
comment.userId,
);
]);
}
const mentionUserIdsSet = new Set(mentionUserIds);