From f1062f48059886668b11f1cb17518643d5a7df56 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 20 Feb 2026 14:35:21 +0100 Subject: [PATCH] Fix admin getting juror assignment email on reshuffle/COI notifyAdmins was using BATCH_ASSIGNED notification type, which triggers the juror assignment email template ('X Projects Assigned'). Admins received confusing emails that looked like they were assigned projects. Changed to EVALUATION_MILESTONE type for admin-facing reshuffle/COI notifications. Also included top receivers in admin notification message. Co-Authored-By: Claude Opus 4.6 --- src/server/routers/assignment.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/server/routers/assignment.ts b/src/server/routers/assignment.ts index 5005849..b9dd7d2 100644 --- a/src/server/routers/assignment.ts +++ b/src/server/routers/assignment.ts @@ -150,10 +150,11 @@ export async function reassignAfterCOI(params: { // Notify admins of the reassignment await notifyAdmins({ - type: NotificationTypes.BATCH_ASSIGNED, + type: NotificationTypes.EVALUATION_MILESTONE, title: 'COI Auto-Reassignment', message: `Project "${assignment.project.title}" was reassigned from ${assignment.user.name || assignment.user.email} to ${replacement.name || replacement.email} due to conflict of interest.`, linkUrl: `/admin/rounds/${roundId}`, + linkLabel: 'View Round', metadata: { projectId, oldJurorId: assignment.userId, @@ -447,10 +448,11 @@ async function reassignDroppedJurorAssignments(params: { .join(', ') await notifyAdmins({ - type: NotificationTypes.BATCH_ASSIGNED, + type: NotificationTypes.EVALUATION_MILESTONE, title: 'Juror Dropout Reshuffle', - message: `Reassigned ${actualMoves.length} project(s) from ${droppedName}. ${failedProjects.length > 0 ? `${failedProjects.length} project(s) could not be reassigned.` : 'All projects were reassigned.'}`, + message: `Reassigned ${actualMoves.length} project(s) from ${droppedName} to: ${topReceivers}. ${failedProjects.length > 0 ? `${failedProjects.length} project(s) could not be reassigned.` : 'All projects were reassigned successfully.'}`, linkUrl: `/admin/rounds/${round.id}`, + linkLabel: 'View Round', metadata: { roundId: round.id, droppedJurorId: droppedJuror.id,