1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-27 09:09:46 +02:00

feat: Add ability to mention users in comments (#1162)

This commit is contained in:
Roman Zavarnitsyn 2025-05-30 22:01:29 +02:00 committed by GitHub
parent eb2a3a2875
commit c0b0436851
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 357 additions and 42 deletions

View file

@ -13,6 +13,7 @@ import { Button } from 'semantic-ui-react';
import selectors from '../../../selectors';
import entryActions from '../../../entry-actions';
import { formatTextWithMentions } from '../../../utils/formatters';
import Paths from '../../../constants/Paths';
import { StaticUserIds } from '../../../constants/StaticUsers';
import { NotificationTypes } from '../../../constants/Enums';
@ -83,7 +84,7 @@ const Item = React.memo(({ id, onClose }) => {
break;
}
case NotificationTypes.COMMENT_CARD: {
const commentText = truncate(notification.data.text);
const commentText = truncate(formatTextWithMentions(notification.data.text));
contentNode = (
<Trans
@ -122,6 +123,28 @@ const Item = React.memo(({ id, onClose }) => {
);
break;
case NotificationTypes.MENTION_IN_COMMENT: {
const commentText = truncate(formatTextWithMentions(notification.data.text));
contentNode = (
<Trans
i18nKey="common.userMentionedYouInCommentOnCard"
values={{
user: creatorUserName,
comment: commentText,
card: cardName,
}}
>
<span className={styles.author}>{creatorUserName}</span>
{` mentioned you in «${commentText}» on `}
<Link to={Paths.CARDS.replace(':id', notification.cardId)} onClick={onClose}>
{cardName}
</Link>
</Trans>
);
break;
}
default:
contentNode = null;
}