fix(visitor_mailer): skip change emails for visitors added by the same edit (PPT-2375) - #624
Open
chillfox wants to merge 8 commits into
Open
fix(visitor_mailer): skip change emails for visitors added by the same edit (PPT-2375)#624chillfox wants to merge 8 commits into
chillfox wants to merge 8 commits into
Conversation
…e edit (PPT-2375)
chillfox
marked this pull request as ready for review
August 4, 2026 06:58
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
marked this pull request as ready for review
August 10, 2026 07:07
Greptile SummaryThe PR prevents visitors added during an edit from receiving a redundant change notification while preserving notifications for existing visitors.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| 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]
Reviews (2): Last reviewed commit: "fix(visitor_mailer): honour the legacy d..." | Re-trigger Greptile
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.