Skip to content

chore: [DHIS2-21542] Remove usage of storedBy#4576

Open
henrikmv wants to merge 3 commits into
hv/chore/DHIS2-20995_limit-fields-paramfrom
hv/chore/DHIS2-21542_remove-storedby
Open

chore: [DHIS2-21542] Remove usage of storedBy#4576
henrikmv wants to merge 3 commits into
hv/chore/DHIS2-20995_limit-fields-paramfrom
hv/chore/DHIS2-21542_remove-storedby

Conversation

@henrikmv
Copy link
Copy Markdown
Contributor

@henrikmv henrikmv commented May 21, 2026

DHIS2-21542

This PR removes the storedBy field and associated userName usage from all note-related code. Across multiple epics, types, and components:

  • API requests no longer fetch userName
  • storedBy: userName is no longer set on note objects
  • storedBy is removed from all type definitions
  • The Notes component no longer falls back to storedBy when createdBy is absent

The display now relies exclusively on createdBy.firstName / createdBy.surname.

@henrikmv henrikmv changed the base branch from master to hv/chore/DHIS2-20995_limit-fields-param May 21, 2026 18:19
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

View 2 additional findings in Devin Review.

Open in Devin Review

Comment thread src/core_modules/capture-core/components/Notes/Notes.component.tsx
Comment on lines 50 to 54
surname,
uid: clientId,
},
storedBy: userName,
storedAt: fromClientDate(moment().toISOString()).getServerZonedISOString(),
};
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot May 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 WidgetEnrollmentNote clientNote lacks clientId — no rollback mechanism for failed saves

The ClientNote type in WidgetEnrollmentNote.types.ts does not include a clientId field, unlike the notes in viewEventNotes.epics.ts and addNoteForNewSingleEvent.epics.ts which include clientId: uuid(). The enrollment note reducer at enrollmentDomain.reducerDescription.ts:255-261 appends notes but has no matching remove/rollback handler for ADD_NOTE_FAILED_FOR_ENROLLMENT. This means if saving an enrollment note fails, the optimistically-added note remains in state. This is pre-existing behavior unchanged by this PR.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great comment! This will be improved in #4577.

@henrikmv henrikmv marked this pull request as ready for review May 22, 2026 09:46
@henrikmv henrikmv requested a review from a team as a code owner May 22, 2026 09:46
@sonarqubecloud
Copy link
Copy Markdown

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.

1 participant