From d3d45abd352a6b9609d732c24a718fef83b076c7 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Thu, 5 Oct 2023 11:56:30 +0200 Subject: [PATCH] fix: handle both Set and array for currentUser.authorities when checking interpretations access (DHIS2-15964) --- .../InterpretationModal.js | 2 +- .../InterpretationThread.js | 84 +++--- .../Interpretations/common/Message/Message.js | 1 + .../__tests__/getInterpretationAccess.spec.js | 243 +++++++++++++++++- .../common/getInterpretationAccess.js | 35 ++- ...IfNumber.js => addToTotalIfNumber.spec.js} | 0 yarn.lock | 41 +-- 7 files changed, 311 insertions(+), 95 deletions(-) rename src/modules/pivotTable/__tests__/{addToTotalIfNumber.js => addToTotalIfNumber.spec.js} (100%) diff --git a/src/components/Interpretations/InterpretationModal/InterpretationModal.js b/src/components/Interpretations/InterpretationModal/InterpretationModal.js index 6853ed4ed..5cc5050bd 100644 --- a/src/components/Interpretations/InterpretationModal/InterpretationModal.js +++ b/src/components/Interpretations/InterpretationModal/InterpretationModal.js @@ -24,7 +24,7 @@ const modalCSS = css.resolve` max-width: calc(100vw - 128px) !important; max-height: calc(100vh - 128px) !important; width: auto !important; - height: calc(100vw - 128px) !important; + height: calc(100vh - 128px) !important; overflow-y: hidden; } aside.hidden { diff --git a/src/components/Interpretations/InterpretationModal/InterpretationThread.js b/src/components/Interpretations/InterpretationModal/InterpretationThread.js index ec4a8b624..03686cd7b 100644 --- a/src/components/Interpretations/InterpretationModal/InterpretationThread.js +++ b/src/components/Interpretations/InterpretationModal/InterpretationThread.js @@ -35,57 +35,47 @@ const InterpretationThread = ({ return (
-
-
- - {moment(fromServerDate(interpretation.created)).format( - 'LLL' - )} -
- {DownloadMenu && ( - - )} -
- focusRef.current?.focus() - : null - } - onUpdated={() => onThreadUpdated(true)} - onDeleted={onInterpretationDeleted} - isInThread={true} - /> -
- {interpretation.comments.map((comment) => ( - - ))} -
- {interpretationAccess.comment && ( - + + {moment(fromServerDate(interpretation.created)).format('LLL')} +
+ {DownloadMenu && ( + + )} +
+ focusRef.current?.focus() + : null + } + onUpdated={() => onThreadUpdated(true)} + onDeleted={onInterpretationDeleted} + isInThread={true} + /> +
+ {interpretation.comments.map((comment) => ( + onThreadUpdated(true)} - focusRef={focusRef} + onThreadUpdated={onThreadUpdated} + canComment={interpretationAccess.comment} /> - )} + ))}
- onThreadUpdated(true)} - focusRef={focusRef} - /> + {interpretationAccess.comment && ( + onThreadUpdated(true)} + focusRef={focusRef} + /> + )}