Skip to content

fix(visitor_mailer): skip change emails for visitors added by the same edit (PPT-2375) - #624

Open
chillfox wants to merge 8 commits into
masterfrom
PPT-2375_15
Open

fix(visitor_mailer): skip change emails for visitors added by the same edit (PPT-2375)#624
chillfox wants to merge 8 commits into
masterfrom
PPT-2375_15

Conversation

@chillfox

@chillfox chillfox commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@chillfox chillfox self-assigned this Aug 4, 2026
@chillfox
chillfox marked this pull request as ready for review August 4, 2026 06:58
@chillfox
chillfox requested review from naqvis and stakach August 4, 2026 06:59
@chillfox
chillfox marked this pull request as draft August 10, 2026 00:47
…PT-2375)

Recording an invite on any staff/guest/attending signal was wrong. A booking
create signals attendance for every attendee rather than only new ones, and the
front end tears down and re-creates the visitor bookings behind a calendar event
on every save. Moving the room leaves the start time untouched, so those signals
matched the invite key exactly and suppressed the room-move notification.

Record only once an invitation email has actually been sent, so a signal that
produced no email says nothing about whether the visitor is new.
…PPT-2375)

Inviting a visitor and then moving their visit are two separate actions, however
close together, but a location change leaves the times untouched so the two were
indistinguishable by visitor, host and start time alone. Creating a visitor
booking and then relocating it left the visitor unaware of the move.

Record what each invitation was for, and whether that booking or event was
created by the same action. An invitation to the very thing being changed is
simply how the visit began; only an invitation to something else — the visitor's
own child booking under a group parent — means this edit is what added them.

Ordering cannot serve as the discriminator: the single-visitor edit form and the
group container patch both emit the invitation before the change within one
request.
@chillfox
chillfox marked this pull request as ready for review August 10, 2026 07:07
@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown

Greptile Summary

The PR prevents visitors added during an edit from receiving a redundant change notification while preserving notifications for existing visitors.

  • Tracks recently delivered invitations by visitor and visit identity.
  • Debounces both booking and event changes through a shared pending-change pipeline.
  • Preserves compatibility with the legacy event_change_debounce setting.
  • Adds regression coverage for concurrent visits and group-booking invitation ordering.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
drivers/place/visitor_mailer.cr Adds visit-aware invitation tracking, shared booking/event debouncing, legacy-setting compatibility, and suppression of redundant change emails.
drivers/place/visitor_mailer_spec.cr Adds regression coverage for legacy debounce configuration, distinct simultaneous visits, and group-booking invitation identity and ordering.
drivers/place/visitor_mailer_readme.md Documents unified change debouncing and the behavior for visitors added by the same edit.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Visitor invitation delivered] --> B[Record visitor and visit identity]
    C[Booking or event change received] --> D[Buffer and coalesce change]
    D --> E[Fetch current guest list]
    E --> F{Guest recently added to this visit?}
    F -- Yes --> G[Skip redundant change email]
    F -- No --> H[Send change notification]
Loading

Reviews (2): Last reviewed commit: "fix(visitor_mailer): honour the legacy d..." | Re-trigger Greptile

Comment thread drivers/place/visitor_mailer.cr Outdated
Comment thread drivers/place/visitor_mailer.cr Outdated
… apart

Addresses two review findings.

event_change_debounce is read again when change_debounce is absent, so a
deployment configured before the rename keeps its value instead of silently
returning to the default, where notifications would be both delayed and newly
filtered.

Invitations are held individually rather than one per visitor. A visitor can be
announced more than once for the one visit — their own child booking plus the
group container the front end pushes them onto — and collapsing those let a
later, unrelated invitation displace the one showing this edit added them. Each
invitation now also carries the parent booking it sits under, so being added to
a group is told apart from a visit at the same time under a different parent.

The booking mock gained the parent ids the front end actually sets, without
which the group children were modelled as standalone bookings and the collision
could not surface.
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