Skip to content

Fix: Allow empty strings for event settings maps_url #623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

carlosalaniz
Copy link
Contributor

@carlosalaniz carlosalaniz commented Jun 14, 2025

Fix: Allow empty strings for event settings maps_url

Problem

Users were unable to save empty values for the maps URL field in event settings. When attempting to clear an existing maps URL, the system would ignore the empty value and revert to the previously saved URL upon save.

Fixes 🐛 Cannot save empty maps URL in event settings #624

Cause

The issue occurred in the PartialUpdateEventSettingsHandler.php file where the maps_url field was being handled using the null coalescing operator (??):

'maps_url' => $eventSettingsDTO->settings['maps_url'] ?? $existingSettings->getMapsUrl(),

In PHP, this operator treats empty strings as falsy values, causing the system to fall back to the existing value when users attempted to save an empty string.

Solution

Updated the code to use array_key_exists() instead of the null coalescing operator, matching the pattern already used for other text fields in the same handler:

'maps_url' => array_key_exists('maps_url', $eventSettingsDTO->settings)
    ? $eventSettingsDTO->settings['maps_url']
    : $existingSettings->getMapsUrl(),

This approach checks if the key exists in the settings array (regardless of its value), allowing empty strings to be properly saved.

Impact

Event organizers can now:

  • Clear previously set maps URLs when needed
  • Explicitly save empty values for the maps URL field
  • Have a consistent user experience across all text fields in the event settings

This change improves the user experience for event organizers who need to manage location settings for their events.

Checklist

  • I have read the contributing guidelines.
  • My code is of good quality and follows the coding standards of the project.
  • I have tested my changes, and they work as expected.

Thank you for your contribution! 🎉

Copy link
Contributor

github-actions bot commented Jun 14, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@carlosalaniz
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@daveearley
Copy link
Contributor

Thanks for this @carlosalaniz! Change looks good

@daveearley daveearley merged commit b332963 into HiEventsDev:develop Jun 14, 2025
1 check passed
@github-actions github-actions bot locked and limited conversation to collaborators Jun 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Cannot save empty maps URL in event settings
2 participants