Skip to content

fix(email): honor secondary category in reservation email attributes#1119

Merged
JohnVillalovos merged 1 commit intodevelopfrom
jlvillal/reservation_attributes
Mar 8, 2026
Merged

fix(email): honor secondary category in reservation email attributes#1119
JohnVillalovos merged 1 commit intodevelopfrom
jlvillal/reservation_attributes

Conversation

@JohnVillalovos
Copy link
Collaborator

Align ReservationEmailTemplateContext::ReservationAttributes() with reservation attribute scoping rules by filtering scoped attributes using SecondaryCategory():

  • RESOURCE against AllResourceIds()
  • RESOURCE_TYPE against reservation resource type IDs
  • USER against reservation owner ID

This prevents false includes/excludes from ID collisions across category domains and keeps global attributes included.

Closes: #1118

Copilot AI review requested due to automatic review settings March 8, 2026 01:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where ReservationEmailTemplateContext::ReservationAttributes() did not branch on SecondaryCategory() when filtering scoped reservation attributes, causing attributes scoped to RESOURCE_TYPE or USER to be incorrectly matched against resource IDs. The fix aligns the email context logic with the existing AttributeService::GetReservationAttributes() implementation.

Changes:

  • Updated ReservationAttributes() to branch on SecondaryCategory() using a match expression, comparing against resource IDs, resource type IDs, or owner ID depending on the category
  • Added a test (testReservationAttributesRespectSecondaryCategoryWhenScoped) that validates correct filtering across all three secondary categories plus global attributes
  • Extended ReservationEmailTemplateTestAttribute with ForResourceTypeIds() and ForUserIds() helper methods

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/Email/Messages/ReservationEmailTemplateContext.php Branch on SecondaryCategory() in the match expression to intersect against the correct ID domain (resource IDs, resource type IDs, or owner ID)
tests/Application/Reservation/ReservationEmailTemplateContextTest.php Add test covering RESOURCE_TYPE and USER scoped attributes with collision scenarios; add ForResourceTypeIds and ForUserIds helpers

You can also share your feedback on Copilot code review. Take the survey.

Align ReservationEmailTemplateContext::ReservationAttributes() with
reservation attribute scoping rules by filtering scoped attributes using
SecondaryCategory():

- RESOURCE against AllResourceIds()
- RESOURCE_TYPE against reservation resource type IDs
- USER against reservation owner ID

This prevents false includes/excludes from ID collisions across category
domains and keeps global attributes included.

Closes: #1118
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


You can also share your feedback on Copilot code review. Take the survey.

@JohnVillalovos JohnVillalovos merged commit 42c98d5 into develop Mar 8, 2026
19 checks passed
@JohnVillalovos JohnVillalovos deleted the jlvillal/reservation_attributes branch March 8, 2026 01:22
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.

ReservationAttributes() ignores SecondaryCategory() when filtering scoped attributes

2 participants