Problem/Motivation
Previously, the registration creation service would almost be guaranteed to have an event instance or series stored. This was not a good practice and fixed by https://www.drupal.org/project/recurring_events/issues/3452632
In the service's retrieveRegisteredParties() method, the old assumption that an event instance would be present seems to still be in effect. Now, if an event instance has not been stored, retrieveRegisteredParties() will return every single registrant from across the whole site's history. Reviewing the use of retrieveRegisteredParties(), I don't think retrieving all registrants is ever a desired result. I believe this method should fail if an event instance is not specified.
If needed, we could add something like retrieveAllRegisteredParties() for the task of getting site-wide registrants.
Steps to reproduce
In some custom code, load the registration creation service and call retrieveRegisteredParties() method. You will get all registrants on the site, unrestricted to any event.
Proposed resolution
Include a check to retrieveRegisteredParties() whether an event instance is stored. If not, return an exception.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3498718-retrieveRegisteredParties-fix-2.patch | 1.68 KB | chrisla |
Issue fork recurring_events-3498718
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
chrisla commentedattached patch does what I suggest. please advise if a different way of throwing the exception is recommended.
Comment #3
carolpettirossi commentedI had an issue where the site was sending emails to all registrants when a series that doesn't have registration enabled got updated.
The suggested patch did not solve my case. What solved my issue was adding a validation:
Comment #5
chrisla commentedRequesting review and merge