feat(reminders): show reminders in notifications bar
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2023-12-23 15:48:29 +01:00
parent e98e5a0d2f
commit 7f70471894
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 16 additions and 1 deletions

View File

@ -124,6 +124,7 @@ function to(n, index) {
switch (n.name) { switch (n.name) {
case names.TASK_COMMENT: case names.TASK_COMMENT:
case names.TASK_ASSIGNED: case names.TASK_ASSIGNED:
case names.TASK_REMINDER:
to.name = 'task.detail' to.name = 'task.detail'
to.params.id = n.notification.task.id to.params.id = n.notification.task.id
break break

View File

@ -9,6 +9,7 @@ export const NOTIFICATION_NAMES = {
'TASK_COMMENT': 'task.comment', 'TASK_COMMENT': 'task.comment',
'TASK_ASSIGNED': 'task.assigned', 'TASK_ASSIGNED': 'task.assigned',
'TASK_DELETED': 'task.deleted', 'TASK_DELETED': 'task.deleted',
'TASK_REMINDER': 'task.reminder',
'PROJECT_CREATED': 'project.created', 'PROJECT_CREATED': 'project.created',
'TEAM_MEMBER_ADDED': 'team.member.added', 'TEAM_MEMBER_ADDED': 'team.member.added',
} as const } as const
@ -35,6 +36,11 @@ interface NotificationCreated extends Notification {
project: IProject project: IProject
} }
interface NotificationTaskReminder extends Notification {
task: ITask
project: IProject
}
interface NotificationMemberAdded extends Notification { interface NotificationMemberAdded extends Notification {
member: IUser member: IUser
team: ITeam team: ITeam
@ -43,7 +49,7 @@ interface NotificationMemberAdded extends Notification {
export interface INotification extends IAbstract { export interface INotification extends IAbstract {
id: number id: number
name: string name: string
notification: NotificationTask | NotificationAssigned | NotificationDeleted | NotificationCreated | NotificationMemberAdded notification: NotificationTask | NotificationAssigned | NotificationDeleted | NotificationCreated | NotificationMemberAdded | NotificationTaskReminder
read: boolean read: boolean
readAt: Date | null readAt: Date | null

View File

@ -56,6 +56,12 @@ export default class NotificationModel extends AbstractModel<INotification> impl
team: new TeamModel(this.notification.team), team: new TeamModel(this.notification.team),
} }
break break
case NOTIFICATION_NAMES.TASK_REMINDER:
this.notification = {
task: new TaskModel(this.notification.task),
project: new ProjectModel(this.notification.project),
}
break
} }
this.created = new Date(this.created) this.created = new Date(this.created)
@ -88,6 +94,8 @@ export default class NotificationModel extends AbstractModel<INotification> impl
} }
return `added ${who} to the ${this.notification.team.name} team` 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})`
} }
return '' return ''