@@ -17,6 +17,7 @@ import useActiveRoute from '@hooks/useActiveRoute';
1717import useLocalize from '@hooks/useLocalize' ;
1818import useNetwork from '@hooks/useNetwork' ;
1919import useOnyx from '@hooks/useOnyx' ;
20+ import useReportIsArchived from '@hooks/useReportIsArchived' ;
2021import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
2122import useThemeStyles from '@hooks/useThemeStyles' ;
2223import useTransactionViolations from '@hooks/useTransactionViolations' ;
@@ -199,20 +200,21 @@ function MoneyRequestView({allReports, report, policy, shouldShowAnimatedBackgro
199200
200201 const isSettled = isSettledReportUtils ( moneyRequestReport ?. reportID ) ;
201202 const isCancelled = moneyRequestReport && moneyRequestReport ?. isCancelledIOU ;
203+ const isChatReportArchived = useReportIsArchived ( moneyRequestReport ?. chatReportID ) ;
202204
203205 // Flags for allowing or disallowing editing an expense
204206 // Used for non-restricted fields such as: description, category, tag, billable, etc...
205207 const canUserPerformWriteAction = ! ! canUserPerformWriteActionReportUtils ( report ) && ! readonly ;
206- const canEdit = isMoneyRequestAction ( parentReportAction ) && canEditMoneyRequest ( parentReportAction , transaction ) && canUserPerformWriteAction ;
208+ const canEdit = isMoneyRequestAction ( parentReportAction ) && canEditMoneyRequest ( parentReportAction , transaction , isChatReportArchived ) && canUserPerformWriteAction ;
207209
208210 const canEditTaxFields = canEdit && ! isDistanceRequest ;
209- const canEditAmount = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . AMOUNT ) ;
210- const canEditMerchant = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . MERCHANT ) ;
211- const canEditDate = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DATE ) ;
212- const canEditReceipt = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . RECEIPT ) ;
213- const canEditDistance = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DISTANCE ) ;
214- const canEditDistanceRate = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DISTANCE_RATE ) ;
215- const canEditReport = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . REPORT ) ;
211+ const canEditAmount = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . AMOUNT , undefined , isChatReportArchived ) ;
212+ const canEditMerchant = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . MERCHANT , undefined , isChatReportArchived ) ;
213+ const canEditDate = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DATE , undefined , isChatReportArchived ) ;
214+ const canEditReceipt = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . RECEIPT , undefined , isChatReportArchived ) ;
215+ const canEditDistance = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DISTANCE , undefined , isChatReportArchived ) ;
216+ const canEditDistanceRate = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DISTANCE_RATE , undefined , isChatReportArchived ) ;
217+ const canEditReport = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . REPORT , undefined , isChatReportArchived ) ;
216218
217219 // A flag for verifying that the current report is a sub-report of a expense chat
218220 // if the policy of the report is either Collect or Control, then this report must be tied to expense chat
0 commit comments