From c29962174e5391df0c7c9c9b48d2eb55b06098ec Mon Sep 17 00:00:00 2001
From: Maksim Eltyshev
${escapeHtml(notification.data.text)}
`; - break; - case Notification.Types.COMMENT_MENTION: - html = `${t( - '%s mentioned you in %s on %s', - escapeHtml(actorUser.name), - cardLink, - boardLink, - )}
${escapeHtml(notification.data.text)}
`; - break; case Notification.Types.ADD_MEMBER_TO_CARD: html = `${t( @@ -182,6 +175,15 @@ const buildAndSendEmail = async (board, card, notification, actorUser, notifiabl boardLink, )}
`; + break; + case Notification.Types.MENTION_IN_COMMENT: + html = `${t( + '%s mentioned you in %s on %s', + escapeHtml(actorUser.name), + cardLink, + boardLink, + )}
${escapeHtml(notification.data.text)}
`; + break; default: return; @@ -221,11 +223,11 @@ module.exports = { values.userId = values.user.id; } - const isCommentNotification = + const isCommentRelated = values.type === Notification.Types.COMMENT_CARD || - values.type === Notification.Types.COMMENT_MENTION; + values.type === Notification.Types.MENTION_IN_COMMENT; - if (isCommentNotification) { + if (isCommentRelated) { values.commentId = values.comment.id; } else { values.actionId = values.action.id; @@ -254,7 +256,7 @@ module.exports = { boards: [inputs.board], lists: [inputs.list], cards: [values.card], - ...(isCommentNotification + ...(isCommentRelated ? { comments: [values.comment], } diff --git a/server/api/models/Notification.js b/server/api/models/Notification.js index 2b37966a..2d9763a6 100755 --- a/server/api/models/Notification.js +++ b/server/api/models/Notification.js @@ -13,8 +13,8 @@ const Types = { MOVE_CARD: 'moveCard', COMMENT_CARD: 'commentCard', - COMMENT_MENTION: 'commentMention', ADD_MEMBER_TO_CARD: 'addMemberToCard', + MENTION_IN_COMMENT: 'mentionInComment', }; module.exports = { diff --git a/server/config/locales/en-GB.json b/server/config/locales/en-GB.json index 9e9c1322..1a7b7420 100644 --- a/server/config/locales/en-GB.json +++ b/server/config/locales/en-GB.json @@ -7,8 +7,10 @@ "This is a *test* **markdown** `message`!": "This is a *test* **markdown** `message`!", "This is a test htmlmessage
": "This is a test html message
",
"You Were Added to Card": "Your Were Added to Card",
+ "You Were Mentioned in Comment": "You Were Mentioned in Comment",
"%s added you to %s on %s": "%s added you to %s on %s",
"%s created %s in %s on %s": "%s created %s in %s on %s",
"%s left a new comment to %s on %s": "%s left a new comment to %s on %s",
+ "%s mentioned you in %s on %s": "%s mentioned you in %s on %s",
"%s moved %s from %s to %s on %s": "%s moved %s from %s to %s on %s"
}
diff --git a/server/config/locales/en-US.json b/server/config/locales/en-US.json
index f0bedb9c..edea5f0c 100644
--- a/server/config/locales/en-US.json
+++ b/server/config/locales/en-US.json
@@ -2,15 +2,15 @@
"Card Created": "Card Created",
"Card Moved": "Card Moved",
"New Comment": "New Comment",
- "You Were Mentioned in a Comment": "You Were Mentioned in a Comment",
"Test Title": "Test Title",
"This is a test text message!": "This is a test text message!",
"This is a *test* **markdown** `message`!": "This is a *test* **markdown** `message`!",
"This is a test html message
": "This is a test html message
",
"You Were Added to Card": "Your Were Added to Card",
+ "You Were Mentioned in Comment": "You Were Mentioned in Comment",
"%s added you to %s on %s": "%s added you to %s on %s",
"%s created %s in %s on %s": "%s created %s in %s on %s",
"%s left a new comment to %s on %s": "%s left a new comment to %s on %s",
- "%s moved %s from %s to %s on %s": "%s moved %s from %s to %s on %s",
- "%s mentioned you in %s on %s": "%s mentioned you in %s on %s"
+ "%s mentioned you in %s on %s": "%s mentioned you in %s on %s",
+ "%s moved %s from %s to %s on %s": "%s moved %s from %s to %s on %s"
}
diff --git a/server/config/locales/ru-RU.json b/server/config/locales/ru-RU.json
index 6f300160..fbd67b79 100644
--- a/server/config/locales/ru-RU.json
+++ b/server/config/locales/ru-RU.json
@@ -7,8 +7,10 @@
"This is a *test* **markdown** `message`!": "Это *тестовое* **markdown** `сообщение`!",
"This is a test html message
": "Это тестовое html сообщение
",
"You Were Added to Card": "Вы были добавлены к карточке",
+ "You Were Mentioned in Comment": "Вы были упомянуты в комментарии",
"%s added you to %s on %s": "%s добавил(а) вас к %s на %s",
"%s created %s in %s on %s": "%s создал(а) %s в %s на %s",
"%s left a new comment to %s on %s": "%s оставил(а) новый комментарий к %s на %s",
+ "%s mentioned you in %s on %s": "%s упомянул(а) вас в %s на %s",
"%s moved %s from %s to %s on %s": "%s переместил(а) %s из %s в %s на %s"
}
diff --git a/server/utils/formatters.js b/server/utils/formatters.js
new file mode 100644
index 00000000..6c266c6b
--- /dev/null
+++ b/server/utils/formatters.js
@@ -0,0 +1,7 @@
+const MENTIONS_REGEX = /@\[(.*?)\]\(.*?\)/g;
+
+const formatTextWithMentions = (text) => text.replace(MENTIONS_REGEX, '@$1');
+
+module.exports = {
+ formatTextWithMentions,
+};