diff --git a/frontend/src/components/notifications/Notifications.vue b/frontend/src/components/notifications/Notifications.vue index 07ac04293..e6aeaa70b 100644 --- a/frontend/src/components/notifications/Notifications.vue +++ b/frontend/src/components/notifications/Notifications.vue @@ -159,6 +159,7 @@ function to(n, index) { case names.TASK_COMMENT: case names.TASK_ASSIGNED: case names.TASK_REMINDER: + case names.TASK_MENTIONED: to.name = 'task.detail' to.params.id = n.notification.task.id break diff --git a/frontend/src/modelTypes/INotification.ts b/frontend/src/modelTypes/INotification.ts index 1a97968d3..b26b5fffe 100644 --- a/frontend/src/modelTypes/INotification.ts +++ b/frontend/src/modelTypes/INotification.ts @@ -12,25 +12,27 @@ export const NOTIFICATION_NAMES = { 'TASK_REMINDER': 'task.reminder', 'PROJECT_CREATED': 'project.created', 'TEAM_MEMBER_ADDED': 'team.member.added', + 'TASK_MENTIONED': 'task.mentioned', } as const interface Notification { doer: IUser } -interface NotificationTask extends Notification { + +interface NotificationTaskComment extends Notification { task: ITask comment: ITaskComment } +interface NotificationTask extends Notification { + task: ITask +} + interface NotificationAssigned extends Notification { task: ITask assignee: IUser } -interface NotificationDeleted extends Notification { - task: ITask -} - interface NotificationCreated extends Notification { task: ITask project: IProject @@ -49,7 +51,7 @@ interface NotificationMemberAdded extends Notification { export interface INotification extends IAbstract { id: number name: string - notification: NotificationTask | NotificationAssigned | NotificationDeleted | NotificationCreated | NotificationMemberAdded | NotificationTaskReminder + notification: NotificationTaskComment | NotificationTask | NotificationAssigned | NotificationCreated | NotificationMemberAdded | NotificationTaskReminder read: boolean readAt: Date | null diff --git a/frontend/src/models/notification.ts b/frontend/src/models/notification.ts index e8a1960b3..516f68094 100644 --- a/frontend/src/models/notification.ts +++ b/frontend/src/models/notification.ts @@ -62,6 +62,12 @@ export default class NotificationModel extends AbstractModel impl project: new ProjectModel(this.notification.project), } break + case NOTIFICATION_NAMES.TASK_MENTIONED: + this.notification = { + doer: new UserModel(this.notification.doer), + task: new TaskModel(this.notification.task), + } + break } this.created = new Date(this.created) @@ -96,6 +102,8 @@ export default class NotificationModel extends AbstractModel impl return `added ${who} to the ${this.notification.team.name} team` case NOTIFICATION_NAMES.TASK_REMINDER: return `Reminder for ${this.notification.task.getTextIdentifier()} ${this.notification.task.title} (${this.notification.project.title})` + case NOTIFICATION_NAMES.TASK_MENTIONED: + return `${getDisplayName(this.notification.doer)} mentioned you on ${this.notification.task.getTextIdentifier()}` } return ''