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

feat: Add notification when user is added to card

This commit is contained in:
Maksim Eltyshev 2025-05-17 01:50:40 +02:00
parent f43785c3d0
commit f6568ce41b
14 changed files with 169 additions and 39 deletions

View file

@ -84,6 +84,36 @@ const Item = React.memo(({ id }) => {
break;
}
case ActivityTypes.ADD_MEMBER_TO_CARD:
contentNode =
user.id === activity.data.user.id ? (
<Trans
i18nKey="common.userJoinedThisCard"
values={{
user: userName,
}}
>
<span className={styles.author}>{userName}</span>
<span className={styles.text}>{' joined this card'}</span>
</Trans>
) : (
<Trans
i18nKey="common.userAddedUserToThisCard"
values={{
actorUser: userName,
addedUser: activity.data.user.name,
}}
>
<span className={styles.author}>{userName}</span>
<span className={styles.text}>
{' added '}
{activity.data.user.name}
{' to this card'}
</span>
</Trans>
);
break;
default:
contentNode = null;
}

View file

@ -103,6 +103,24 @@ const Item = React.memo(({ id, onClose }) => {
break;
}
case NotificationTypes.ADD_MEMBER_TO_CARD:
contentNode = (
<Trans
i18nKey="common.userAddedYouToCard"
values={{
user: creatorUserName,
card: cardName,
}}
>
{creatorUserName}
{` added you to `}
<Link to={Paths.CARDS.replace(':id', notification.cardId)} onClick={onClose}>
{cardName}
</Link>
</Trans>
);
break;
default:
contentNode = null;
}

View file

@ -90,11 +90,13 @@ export const AttachmentTypes = {
export const ActivityTypes = {
CREATE_CARD: 'createCard',
MOVE_CARD: 'moveCard',
ADD_MEMBER_TO_CARD: 'addMemberToCard',
};
export const NotificationTypes = {
MOVE_CARD: 'moveCard',
COMMENT_CARD: 'commentCard',
ADD_MEMBER_TO_CARD: 'addMemberToCard',
};
export const NotificationServiceFormats = {

View file

@ -287,6 +287,9 @@ export default {
uploadedImages: 'Uploaded images',
userActions_title: 'User Actions',
userAddedThisCardToList: '<0>{{user}}</0><1> added this card to {{list}}</1>',
userAddedUserToThisCard: '<0>{{actorUser}}</0><1> added {{addedUser}} to this card</1>',
userAddedYouToCard: '{{user}} added you to <2>{{card}}</2>',
userJoinedThisCard: `<0>{{user}}</0><1> joined this card</1>`,
userLeftNewCommentToCard: '{{user}} left a new comment «{{comment}}» to <2>{{card}}</2>',
userMovedCardFromListToList: '{{user}} moved <2>{{card}}</2> from {{fromList}} to {{toList}}',
userMovedThisCardFromListToList:

View file

@ -282,6 +282,9 @@ export default {
uploadedImages: 'Uploaded images',
userActions_title: 'User Actions',
userAddedThisCardToList: '<0>{{user}}</0><1> added this card to {{list}}</1>',
userAddedUserToThisCard: '<0>{{actorUser}}</0><1> added {{addedUser}} to this card</1>',
userAddedYouToCard: '{{user}} added you to <2>{{card}}</2>',
userJoinedThisCard: `<0>{{user}}</0><1> joined this card</1>`,
userLeftNewCommentToCard: '{{user}} left a new comment «{{comment}}» to <2>{{card}}</2>',
userMovedCardFromListToList: '{{user}} moved <2>{{card}}</2> from {{fromList}} to {{toList}}',
userMovedThisCardFromListToList: