uwazi icon indicating copy to clipboard operation
uwazi copied to clipboard

Update geolocation /api/search endpoint consumers

Open LaszloKecskes opened this issue 2 years ago • 1 comments

The initial issue: #4403 and resolving pr: #4768.

The problem was that the search endpoint with the geolocation flag contained old pre-permissions or even pre-denormalization code, and performed it's own "denormalization" process on inherited values by fetching the related entities, checking the published state, and copying the values into an inherited_geolocation field in the metadata. The immediate fix was that now the (denormalized) inheritedValue is just copied into that new field (since the current view is that if a value is denormalized on the entity, it is okay to show it, regardless of permissions). See app/api/search/specs/search.searchGeolocations.spec.ts for examples.

However, the correct behavior would be just returning the inherited values, and use that. Currently, we return both, to not break current consumers of the endpoint. The frontend task in this issue is to change the consumers of the /api/search endpoint, which use it with the geolocation flag, to use inheritedValue on inherited properties instead of the current inherited_geolocation. The backend task is that after it is done, remove the inherited_geolocation field from the results entirely, making sure that the frontend changes still work and nothing breaks.

LaszloKecskes avatar Jun 23 '22 07:06 LaszloKecskes

Long story short, this code is:

  • Sending duplicate data from the server side for backwards compatibility
  • Adding some overhead in post-processing the duplicate data
  • If the post-processing is removed, it may break some components (ie. custom maps in pages)

txau avatar Jul 22 '22 14:07 txau