Fix registration_policy changes not captured in event changelog#11232
Merged
Fix registration_policy changes not captured in event changelog#11232
Conversation
The `apply_registration_policy` method was calling `event.reload` after `EventChangeRegistrationPolicyService`, causing `event.registration_policy` to already reflect the new policy. As a result, both `previous_value` and `new_value` in the FormResponseChange record were set to the new policy. Fix by capturing `old_registration_policy` before calling the service and reload. Also adds tests verifying correct previous/new values are stored and that registration_policy changes flow through to the notification service. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Code Coverage Report: Only Changed Files listed
Minimum allowed coverage is |
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.
Summary
UpdateEventmutation would record the same value for bothprevious_valueandnew_valuein theFormResponseChangechangelog entryapply_registration_policycalledevent.reloadafterEventChangeRegistrationPolicyService, which overwrote the in-memory event with the saved new policy — soevent.registration_policywas already the new policy when we tried to capture the old oneold_registration_policy = event.registration_policybefore calling the service and reloadTest plan
test/graphql/mutations/update_event_test.rbwith tests that verify:FormResponseChangeis created forregistration_policychangesprevious_valueis the old policy, not the new onenew_valueis the new policyprevious_valueandnew_valueare differentNotifyFormResponseChangesServicetest/graphql/mutations/update_event_proposal_test.rbwith tests that verify:FormResponseChangeFixes #10998
🤖 Generated with Claude Code