Include resources on maps only when the geocoding got valid coords #8037
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.
🎩 What? Why?
For in-person meetings, it is not allowed to leave the
address
field empty, or with a value that can't be located in the geocoding service database. But online meetings allow admins to leave it empty, and in that case the geocoding library storesNaN
for thelongitude
andlatitude
fields. As these values are notnil
orfalse
, thegeocoded?
method returnstrue
, even when those values are not valid. This results in the meetings map to raise a JS error and to appear completely empty, as explained in #7983.This PR adds a new method
geocoded_and_valid?
that is used to avoid trying to paint the online meetings on the map. I didn't override thegeocoded?
method because it could be used by the library to try to geocode the meeting again if it returnsfalse
.📌 Related Issues
Testing
meetings
component