@@ -235,19 +235,20 @@ function MoneyRequestView({
235235
236236 // Flags for allowing or disallowing editing an expense
237237 // Used for non-restricted fields such as: description, category, tag, billable, etc...
238- const canUserPerformWriteAction = ! ! canUserPerformWriteActionReportUtils ( report ) && ! readonly ;
239- const canEdit = isMoneyRequestAction ( parentReportAction ) && canEditMoneyRequest ( parentReportAction , transaction , isChatReportArchived ) && canUserPerformWriteAction ;
238+ const isReportArchived = useReportIsArchived ( report ?. reportID ) ;
239+ const isEditable = ! ! canUserPerformWriteActionReportUtils ( report , isReportArchived ) && ! readonly ;
240+ const canEdit = isMoneyRequestAction ( parentReportAction ) && canEditMoneyRequest ( parentReportAction , transaction , isChatReportArchived ) && isEditable ;
240241
241242 const canEditTaxFields = canEdit && ! isDistanceRequest ;
242- const canEditAmount = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . AMOUNT , undefined , isChatReportArchived ) ;
243- const canEditMerchant = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . MERCHANT , undefined , isChatReportArchived ) ;
244- const canEditDate = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DATE , undefined , isChatReportArchived ) ;
245- const canEditReceipt = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . RECEIPT , undefined , isChatReportArchived ) ;
246- const canEditDistance = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DISTANCE , undefined , isChatReportArchived ) ;
247- const canEditDistanceRate = canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DISTANCE_RATE , undefined , isChatReportArchived ) ;
243+ const canEditAmount = isEditable && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . AMOUNT , undefined , isChatReportArchived ) ;
244+ const canEditMerchant = isEditable && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . MERCHANT , undefined , isChatReportArchived ) ;
245+ const canEditDate = isEditable && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DATE , undefined , isChatReportArchived ) ;
246+ const canEditReceipt = isEditable && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . RECEIPT , undefined , isChatReportArchived ) ;
247+ const canEditDistance = isEditable && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DISTANCE , undefined , isChatReportArchived ) ;
248+ const canEditDistanceRate = isEditable && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . DISTANCE_RATE , undefined , isChatReportArchived ) ;
248249 const canEditReport = useMemo (
249- ( ) => canUserPerformWriteAction && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . REPORT , undefined , isChatReportArchived , outstandingReportsByPolicyID ) ,
250- [ canUserPerformWriteAction , parentReportAction , isChatReportArchived , outstandingReportsByPolicyID ] ,
250+ ( ) => isEditable && canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . REPORT , undefined , isChatReportArchived , outstandingReportsByPolicyID ) ,
251+ [ isEditable , parentReportAction , isChatReportArchived , outstandingReportsByPolicyID ] ,
251252 ) ;
252253
253254 // A flag for verifying that the current report is a sub-report of a expense chat
0 commit comments