TaskView is a self-hosted project and task management platform focused on clarity, ownership, and control. TaskView is built for teams that want a transparent, self-hosted alternative to SaaS task managers.
TypeScript graphviewkanban-boardnodejsproductivityproject-managementself-hostedtasktask-managementtask-managertodoapp
wip: exclude initiator from notifications
Nikolai Giman5c4859743e32
diff --git a/api/src/tv-modules/notifications/notifications.events.ts b/api/src/tv-modules/notifications/notifications.events.tsindex c9d4322..358f382 100644--- a/api/src/tv-modules/notifications/notifications.events.ts+++ b/api/src/tv-modules/notifications/notifications.events.ts@@ -20,9 +20,10 @@ interface DeadlineJobData {owner: number;endDate: string;endTime: string | null;+ initiatorId: number | null;}-async function scheduleDeadlineJob(task: { id: number; description: string | null; goalId: number; goalListId: number | null; owner: number | null; endDate: string | null; endTime: string | null }) {+async function scheduleDeadlineJob(task: { id: number; description: string | null; goalId: number; goalListId: number | null; owner: number | null; endDate: string | null; endTime: string | null }, initiatorId?: number) {if (!task.endDate) return;const boss = getJobQueue();@@ -43,6 +44,7 @@ async function scheduleDeadlineJob(task: { id: number; description: string | nulowner: task.owner,endDate: task.endDate,endTime: task.endTime,+ initiatorId: initiatorId ?? null,}, {startAfter: startAfter >= now ? startAfter : undefined,singletonKey: jobKey,@@ -55,28 +57,23 @@ export function registerNotificationEventHandlers() {// New task created with deadlineeventBus.on('task.created', async (data) => {- $logger.info({ taskId: data.task.id, endDate: data.task.endDate }, '[Notifications] task.created event');if (data.task.endDate) {- await scheduleDeadlineJob(data.task);+ await scheduleDeadlineJob(data.task, data.userId);}});// Deadline changed on existing taskeventBus.on('task.updated', async (data) => {- $logger.info({ taskId: data.task.id, changes: data.changes }, '[Notifications] task.updated event');const hasDeadlineChange =data.changes.endDate !== undefined ||data.changes.startDate !== undefined ||data.changes.endTime !== undefined ||data.changes.startTime !== undefined;- if (!hasDeadlineChange) {- $logger.info({ taskId: data.task.id }, '[Notifications] No deadline change, skipping');- return;- }+ if (!hasDeadlineChange) return;repo.deleteDeadlineNotifications(data.task.id);- await scheduleDeadlineJob(data.task);+ await scheduleDeadlineJob(data.task, data.userId);});// Assignees changed — reschedule deadline job so new users get notified@@ -104,7 +101,7 @@ export async function registerNotificationWorkers() {// Worker: process deadline notificationsawait boss.work<DeadlineJobData>(DEADLINE_JOB, async ([job]) => {$logger.info({ jobData: job.data }, '[Notifications] Deadline worker received job');- const { taskId, description, goalId, goalListId, endDate, endTime } = job.data;+ const { taskId, description, goalId, goalListId, endDate, endTime, initiatorId } = job.data;// Check if task is still active (not completed or deleted)const task = await db.dbDrizzle@@ -145,6 +142,9 @@ export async function registerNotificationWorkers() {recipientIds.add(goalResult[0].owner);}+ // Don't notify the person who made the change+ if (initiatorId) recipientIds.delete(initiatorId);+$logger.info({ taskId, recipientIds: [...recipientIds], assignees: assigneesResult, goalOwner: goalResult[0]?.owner }, '[Notifications] Recipients resolved');const title = `Deadline: ${description || 'Task'}`;