Skip to content

Commit 3d2450a

Browse files
committed
Address comments
1 parent 1fc9ec7 commit 3d2450a

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

src/hooks/useCurrentReportID.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const CurrentReportIDActionsContext = createContext<CurrentReportIDActionsContex
5151

5252
function CurrentReportIDContextProvider(props: CurrentReportIDContextProviderProps) {
5353
const [currentReportID, setCurrentReportID] = useState<string | undefined>('');
54-
const [currentRHPReportID, setCurrentModalReportID] = useState<string | undefined>(undefined);
54+
const [currentRHPReportID, setCurrentRHPReportID] = useState<string | undefined>(undefined);
5555

5656
/**
5757
* This function is used to update the currentReportID and currentRHPReportID
@@ -83,11 +83,11 @@ function CurrentReportIDContextProvider(props: CurrentReportIDContextProviderPro
8383
const modalReportID = focusedTopRoute?.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR && focusedTopRoute.state ? getFocusedRouteReportID(focusedTopRoute.state) : undefined;
8484

8585
if (currentRHPReportID !== modalReportID && (currentRHPReportID || modalReportID)) {
86-
setCurrentModalReportID(modalReportID);
86+
setCurrentRHPReportID(modalReportID);
8787
}
8888
},
8989
// eslint-disable-next-line react-hooks/exhaustive-deps -- we don't want to re-render when onSetCurrentReportID changes
90-
[setCurrentReportID, currentReportID, setCurrentModalReportID, currentRHPReportID],
90+
[setCurrentReportID, currentReportID, setCurrentRHPReportID, currentRHPReportID],
9191
);
9292

9393
const actionsContextValue = useMemo<CurrentReportIDActionsContextType>(

src/libs/actions/Report/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ type AddAttachmentWithCommentParams = {
379379
timezone?: Timezone;
380380
shouldPlaySound?: boolean;
381381
isInSidePanel?: boolean;
382+
sidePanelContext?: SidePanelContext;
382383
};
383384

384385
const addNewMessageWithText = new Set<string>([WRITE_COMMANDS.ADD_COMMENT, WRITE_COMMANDS.ADD_TEXT_AND_ATTACHMENT]);
@@ -807,7 +808,7 @@ function addActions({
807808
}
808809
}
809810

810-
if (isInSidePanel && isConciergeChat && sidePanelContext) {
811+
if (isInSidePanel && isConciergeChat && sidePanelContext && commandName === WRITE_COMMANDS.ADD_COMMENT) {
811812
parameters.sidePanelContext = JSON.stringify(sidePanelContext);
812813
}
813814

@@ -936,6 +937,7 @@ function addAttachmentWithComment({
936937
timezone = CONST.DEFAULT_TIME_ZONE,
937938
shouldPlaySound = false,
938939
isInSidePanel = false,
940+
sidePanelContext,
939941
}: AddAttachmentWithCommentParams) {
940942
if (!report?.reportID) {
941943
return;
@@ -950,17 +952,17 @@ function addAttachmentWithComment({
950952

951953
// Single attachment
952954
if (!Array.isArray(attachments)) {
953-
addActions({report, notifyReportID, ancestors, timezoneParam: timezone, currentUserAccountID, text, file: attachments, isInSidePanel});
955+
addActions({report, notifyReportID, ancestors, timezoneParam: timezone, currentUserAccountID, text, file: attachments, isInSidePanel, sidePanelContext});
954956
handlePlaySound();
955957
return;
956958
}
957959

958960
// Multiple attachments - first: combine text + first attachment as a single action
959-
addActions({report, notifyReportID, ancestors, timezoneParam: timezone, currentUserAccountID, text, file: attachments?.at(0), isInSidePanel});
961+
addActions({report, notifyReportID, ancestors, timezoneParam: timezone, currentUserAccountID, text, file: attachments?.at(0), isInSidePanel, sidePanelContext});
960962

961963
// Remaining: attachment-only actions (no text duplication)
962964
for (let i = 1; i < attachments?.length; i += 1) {
963-
addActions({report, notifyReportID, ancestors, timezoneParam: timezone, currentUserAccountID, text: '', file: attachments?.at(i), isInSidePanel});
965+
addActions({report, notifyReportID, ancestors, timezoneParam: timezone, currentUserAccountID, text: '', file: attachments?.at(i), isInSidePanel, sidePanelContext});
964966
}
965967

966968
// Play sound once

src/pages/inbox/report/ReportActionCompose/ReportActionCompose.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ function ReportActionCompose({reportID}: ReportActionComposeProps) {
422422
timezone: currentUserPersonalDetails.timezone,
423423
shouldPlaySound: true,
424424
isInSidePanel,
425+
sidePanelContext,
425426
});
426427
attachmentFileRef.current = null;
427428
} else {

0 commit comments

Comments
 (0)