Also log staff cancellations via PUT /api/registrations/:id
Registrations can be cancelled two ways: DELETE /:id (owner or admin, already logged registration_cancelled) and PUT /:id (staff+, status change endpoint) — the latter was silently unlogged. Since PUT /:id is staff-only, any transition into 'cancelled' there is inherently a staff-initiated cancellation, so it's now logged the same way. Audited all six categories promised in the 1.10.0 changelog entry (refunds, donation assign/unassign, manual registrations, staff-initiated cancellations, event create/update/delete, settings changes) against their actual logAdminAction call sites and route wiring — this was the only other gap found. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CSWFWQsjTc9GyffPiXEDQT
This commit is contained in:
@@ -626,6 +626,22 @@ const updateRegistrationStatus = async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// This is the staff-only status-change endpoint (separate from the owner-facing
|
||||
// DELETE /:id cancel route), so any transition into 'cancelled' here is always a
|
||||
// staff-initiated cancellation — log it the same way DELETE /:id does, so both
|
||||
// paths land under the one 'registration_cancelled' filter in the audit log.
|
||||
if (status === 'cancelled' && registration.status !== 'cancelled') {
|
||||
logAdminAction({
|
||||
actorId: req.user.id,
|
||||
actorRole: req.user.role,
|
||||
action: 'registration_cancelled',
|
||||
targetType: 'Registration',
|
||||
targetId: req.params.id,
|
||||
metadata: { registrationOwnerId: registration.userId, previousStatus: registration.status },
|
||||
ip: getClientIp(req),
|
||||
});
|
||||
}
|
||||
|
||||
// Generate tickets and email them when status is manually set to 'paid' by staff
|
||||
if (status === 'paid') {
|
||||
(async () => {
|
||||
|
||||
Reference in New Issue
Block a user