Skip to content

Commit

Permalink
Fix #2573 - don't show location indicator if observation has no coord…
Browse files Browse the repository at this point in the history
…inates
  • Loading branch information
budowski committed Jan 21, 2025
1 parent 47cf9f8 commit cead68a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/components/SharedComponents/Map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@ const Map = ( {
!observation.obscured || observation.privateLatitude
);

const latitude = observation?.privateLatitude || observation?.latitude;
const longitude = observation?.privateLongitude || observation?.longitude;
const hasCoordinates = latitude && longitude;

return (
<View
style={mapContainerStyle}
Expand Down Expand Up @@ -490,18 +494,18 @@ const Map = ( {
}
/>
)}
{ observation && ( currentUserCanViewCoords
{ observation && hasCoordinates && ( currentUserCanViewCoords
? (
<LocationIndicator
latitude={observation.privateLatitude || observation.latitude}
longitude={observation.privateLongitude || observation.longitude}
latitude={latitude}
longitude={longitude}
positionalAccuracy={observation.positionalAccuracy}
/>
)
: (
<ObscuredLocationIndicator
latitude={observation.privateLatitude || observation.latitude}
longitude={observation.privateLongitude || observation.longitude}
latitude={latitude}
longitude={longitude}
/>
)
) }
Expand Down

0 comments on commit cead68a

Please sign in to comment.