@@ -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' ;
@@ -198,20 +199,21 @@ function MoneyRequestView({allReports, report, policy, shouldShowAnimatedBackgro
198199
199200 const isSettled = isSettledReportUtils ( moneyRequestReport ?. reportID ) ;
200201 const isCancelled = moneyRequestReport && moneyRequestReport ?. isCancelledIOU ;
202+ const isChatReportArchived = useReportIsArchived ( moneyRequestReport ?. chatReportID ) ;
201203
202204 // Flags for allowing or disallowing editing an expense
203205 // Used for non-restricted fields such as: description, category, tag, billable, etc...
204206 const canUserPerformWriteAction = ! ! canUserPerformWriteActionReportUtils ( report ) && ! readonly ;
205- const canEdit = isMoneyRequestAction ( parentReportAction ) && canEditMoneyRequest ( parentReportAction , transaction ) && canUserPerformWriteAction ;
207+ const canEdit = isMoneyRequestAction ( parentReportAction ) && canEditMoneyRequest ( parentReportAction , transaction , isChatReportArchived ) && canUserPerformWriteAction ;
206208
207209 const canEditTaxFields = canEdit && ! isDistanceRequest ;
208- const canEditAmount = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . AMOUNT ) ;
209- const canEditMerchant = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . MERCHANT ) ;
210- const canEditDate = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DATE ) ;
211- const canEditReceipt = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . RECEIPT ) ;
212- const canEditDistance = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DISTANCE ) ;
213- const canEditDistanceRate = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DISTANCE_RATE ) ;
214- const canEditReport = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . REPORT ) ;
210+ const canEditAmount = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . AMOUNT , undefined , isChatReportArchived ) ;
211+ const canEditMerchant = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . MERCHANT , undefined , isChatReportArchived ) ;
212+ const canEditDate = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DATE , undefined , isChatReportArchived ) ;
213+ const canEditReceipt = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . RECEIPT , undefined , isChatReportArchived ) ;
214+ const canEditDistance = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DISTANCE , undefined , isChatReportArchived ) ;
215+ const canEditDistanceRate = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DISTANCE_RATE , undefined , isChatReportArchived ) ;
216+ const canEditReport = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . REPORT , undefined , isChatReportArchived ) ;
215217
216218 // A flag for verifying that the current report is a sub-report of a expense chat
217219 // if the policy of the report is either Collect or Control, then this report must be tied to expense chat
0 commit comments