Skip to content

fix: [DHIS2-21871] preserve working-list view sharing on update - #4666

Open
gqcorneby wants to merge 1 commit into
dhis2:masterfrom
EyeSeeTea:DHIS2-21871-preserve-working-list-sharing
Open

fix: [DHIS2-21871] preserve working-list view sharing on update#4666
gqcorneby wants to merge 1 commit into
dhis2:masterfrom
EyeSeeTea:DHIS2-21871-preserve-working-list-sharing

Conversation

@gqcorneby

@gqcorneby gqcorneby commented Jul 27, 2026

Copy link
Copy Markdown

DHIS2-21871

Summary

Saving a working list view (event filter, TEI filter, or program stage working list) wipes its sharing: user and user group accesses are cleared and public access resets to default.

Root cause

The update epics send a full PUT (type: 'replace') with only the legacy sharing fields (publicAccess, externalAccess, userAccesses, userGroupAccesses) and no sharing object. From api/41 those legacy fields are ignored, so a full replace resets sharing to defaults. Regression of DHIS2-8420 (whose fix, DHIS2-10493 / DHIS2-10651, added those legacy fields).

Changes

  • Switch the three update epics (eventFilters, trackedEntityInstanceFilters, programStageWorkingLists) from type: 'replace' to type: 'json-patch', patching only name and the query criteria. Sharing and ownership stay out of the payload, so the server leaves them untouched. (This is DHIS2's documented partial update path; a plain application/json PATCH returns 415 here.)
  • Add a small pure helper toJsonPatchReplaceOps, unit tested.
  • Widen the mutate type in capture-core-utils/types/global.ts to include 'json-patch'.
  • Dropping user (owner) also fixes the non-owner 409 on save (DHIS2-13020).
  • Update the e2e intercepts from PUT to PATCH.

Testing

Verified on play 2.41, 2.43, 2.44: sharing preserved after saving a view. JSON Patch is documented back to 2.40.

Saving a working-list view (event filter, TEI filter, or program-stage
working list) sent a full PUT/replace carrying only the legacy sharing
fields (publicAccess, externalAccess, userAccesses, userGroupAccesses).
From api/41 the metadata update path no longer honours those legacy
fields, so the replace resets the object's sharing to defaults.

Switch the three update epics to a json-patch that touches only name and
query criteria, leaving sharing and ownership untouched. Dropping the
owner field also avoids the 409 for non-owner saves (DHIS2-13020).

Update the working-list e2e intercepts from PUT to PATCH accordingly.
@gqcorneby
gqcorneby requested a review from a team as a code owner July 27, 2026 03:27
@sonarqubecloud

Copy link
Copy Markdown

@henrikmv

henrikmv commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Hi, @gqcorneby!

Thanks for the work on this! We appreciate the effort and will give the PR a closer look soon.

Thanks for your patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants