Regression: Fix delete event participant fatal error and display name if no email #13113
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.
Overview
Bizarrely, this #12775 seems to cause delete participant to fail because it tries to build the contribution search form before deleting and it can't create the cancel_reason field in "delete" context!
To reproduce search for an event participant (with no email address) and select the "delete" option.
Before
After
Technical Details
The event participant delete function was shared with the "edit" function on the core controller. When editing, the contribution form needs to be built and displayed - we don't need to do this for delete participant! Fix is to add a new delete action that only calls the required actions - should be a performance improvement too as we're not building a form we don't need.
Failure to display name is a slight aside, but found whilst debugging, if the contactID is set but has no email address the function
assignContactEmailDetails()
returns nothing. We add an additional call to call the contact API and get the display_name if it was not found in the email call.Comments
Regression in master. But this should also improve code.
@alifrumin Is this something you could test for me? @eileenmcnaughton ping as it was your PR that introduced this regression I think! Though there's no way I'd have expected this side-effect.