@@ -955,6 +955,14 @@ function isProcessingReport(report: OnyxEntry<Report> | EmptyObject): boolean {
955
955
return report ?. stateNum === CONST . REPORT . STATE_NUM . SUBMITTED && report ?. statusNum === CONST . REPORT . STATUS_NUM . SUBMITTED ;
956
956
}
957
957
958
+ /**
959
+ * Returns true if the policy has `instant` reporting frequency and if the report is still being processed (i.e. submitted state)
960
+ */
961
+ function isExpenseReportWithInstantSubmittedState ( report : OnyxEntry < Report > | EmptyObject ) : boolean {
962
+ const policy = allPolicies ?. [ `${ ONYXKEYS . COLLECTION . POLICY } ${ report ?. policyID } ` ] ?? null ;
963
+ return isExpenseReport ( report ) && isProcessingReport ( report ) && PolicyUtils . isInstantSubmitEnabled ( policy ) ;
964
+ }
965
+
958
966
/**
959
967
* Check if the report is a single chat report that isn't a thread
960
968
* and personal detail of participant is optimistic data
@@ -1264,8 +1272,8 @@ function canDeleteReportAction(reportAction: OnyxEntry<ReportAction>, reportID:
1264
1272
1265
1273
if ( isActionOwner ) {
1266
1274
if ( ! isEmptyObject ( report ) && isPaidGroupPolicyExpenseReport ( report ) ) {
1267
- // If it's a paid policy expense report, only allow deleting the request if it's not submitted or the user is the policy admin
1268
- return isDraftExpenseReport ( report ) || PolicyUtils . isPolicyAdmin ( policy ) ;
1275
+ // If it's a paid policy expense report, only allow deleting the request if it's a draft or is instantly submitted or the user is the policy admin
1276
+ return isDraftExpenseReport ( report ) || isExpenseReportWithInstantSubmittedState ( report ) || PolicyUtils . isPolicyAdmin ( policy ) ;
1269
1277
}
1270
1278
return true ;
1271
1279
}
@@ -4238,7 +4246,7 @@ function canRequestMoney(report: OnyxEntry<Report>, policy: OnyxEntry<Policy>, o
4238
4246
if ( isMoneyRequestReport ( report ) ) {
4239
4247
const isOwnExpenseReport = isExpenseReport ( report ) && isOwnPolicyExpenseChat ;
4240
4248
if ( isOwnExpenseReport && PolicyUtils . isPaidGroupPolicy ( policy ) ) {
4241
- return isDraftExpenseReport ( report ) ;
4249
+ return isDraftExpenseReport ( report ) || isExpenseReportWithInstantSubmittedState ( report ) ;
4242
4250
}
4243
4251
4244
4252
return ( isOwnExpenseReport || isIOUReport ( report ) ) && ! isReportApproved ( report ) && ! isSettled ( report ?. reportID ) ;
@@ -5040,6 +5048,7 @@ export {
5040
5048
isPublicAnnounceRoom ,
5041
5049
isConciergeChatReport ,
5042
5050
isProcessingReport ,
5051
+ isExpenseReportWithInstantSubmittedState ,
5043
5052
isCurrentUserTheOnlyParticipant ,
5044
5053
hasAutomatedExpensifyAccountIDs ,
5045
5054
hasExpensifyGuidesEmails ,
0 commit comments