Skip to content

fix(visitor_mailer): don't re-invite visitors when an event changes room (PPT-2375) - #620

Draft
chillfox wants to merge 1 commit into
masterfrom
PPT-2375_13
Draft

fix(visitor_mailer): don't re-invite visitors when an event changes room (PPT-2375)#620
chillfox wants to merge 1 commit into
masterfrom
PPT-2375_13

Conversation

@chillfox

@chillfox chillfox commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Scenario 5 of PPT-2375: "Email notification to all visitors if the location changes — this is working, but the additional email trigger visitor_invited.event should be stopped."

Why it happens

Moving an event to another room makes the staff API re-announce every visitor already attending it on staff/guest/attending, identically to a genuine new invitation. The driver turned each one into a full invitation email on top of the change notification, so visitors got both.

The payloads are indistinguishable, so the driver correlates the two signals instead: an invite arriving as meeting_update is held for the debounce window and dropped if a change notification for the same event turns up. Matched on event_ical_uid and event_id, because either can be missing, and the staff API spawns both signals concurrently so neither order is guaranteed. A short memory of recently changed events covers an invite that arrives after the change email has already gone out, which is also what makes it work with event_change_debounce: 0.

Brand new invitations (meeting_created) are never held.

Also here

The change notification now carries guest_jwt, kiosk_url and the same inline qr.png as an invitation — a move invalidates the kiosk link issued with the original invite (its token is scoped to the old room) and the invite is no longer re-sent. The templates need updating to reference them, or disable_qr_code: true to leave the attachment off.

Trade-offs

  • invitations for visitors added to an existing event are delayed by the debounce window,
  • a visitor added by the same edit that moved the room gets the change notification instead of an invitation — they are in the event guest list, so they are still emailed, and they now get a QR code and kiosk link with it.

Testing

14 new specs: both signal orders, several visitors, invites that must still be sent, meeting_created, event_change_debounce: 0, suppression scoped per event, matching by event_id alone, draining held invites, and the QR/kiosk fields on both changed templates.

./harness report --basic-render --verbose --tests=1 drivers/place/visitor_mailer_spec.cr passes; crystal tool format and ameba clean.

Paired with PlaceOS/staff-api#382, which stops the re-announcement at source. This PR does not depend on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant