Skip to content

Commit 1f35b21

Browse files
committed
Add isReportArchived param and pass the argument where getMoneyRequestOptions is called
1 parent 7ba0f03 commit 1f35b21

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

src/libs/ReportUtils.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8670,16 +8670,12 @@ function isGroupChatAdmin(report: OnyxEntry<Report>, accountID: number) {
86708670
* None of the options should show in chat threads or if there is some special Expensify account
86718671
* as a participant of the report.
86728672
*/
8673-
function getMoneyRequestOptions(report: OnyxEntry<Report>, policy: OnyxEntry<Policy>, reportParticipants: number[], filterDeprecatedTypes = false): IOUType[] {
8673+
function getMoneyRequestOptions(report: OnyxEntry<Report>, policy: OnyxEntry<Policy>, reportParticipants: number[], filterDeprecatedTypes = false, isReportArchived = false): IOUType[] {
86748674
const teacherUnitePolicyID = environment === CONST.ENVIRONMENT.PRODUCTION ? CONST.TEACHERS_UNITE.PROD_POLICY_ID : CONST.TEACHERS_UNITE.TEST_POLICY_ID;
86758675
const isTeachersUniteReport = report?.policyID === teacherUnitePolicyID;
86768676

8677-
// This will get removed as part of https://github.com/Expensify/App/issues/59961
8678-
// eslint-disable-next-line deprecation/deprecation
8679-
const reportNameValuePairs = getReportNameValuePairs(report?.reportID);
8680-
86818677
// In any thread, task report or trip room, we do not allow any new expenses
8682-
if (isChatThread(report) || isTaskReport(report) || isInvoiceReport(report) || isSystemChat(report) || isArchivedReport(reportNameValuePairs) || isTripRoom(report)) {
8678+
if (isChatThread(report) || isTaskReport(report) || isInvoiceReport(report) || isSystemChat(report) || isReportArchived || isTripRoom(report)) {
86838679
return [];
86848680
}
86858681

@@ -8766,8 +8762,9 @@ function temporary_getMoneyRequestOptions(
87668762
report: OnyxEntry<Report>,
87678763
policy: OnyxEntry<Policy>,
87688764
reportParticipants: number[],
8765+
isReportArchived = false,
87698766
): Array<Exclude<IOUType, typeof CONST.IOU.TYPE.REQUEST | typeof CONST.IOU.TYPE.SEND | typeof CONST.IOU.TYPE.CREATE | typeof CONST.IOU.TYPE.SPLIT_EXPENSE>> {
8770-
return getMoneyRequestOptions(report, policy, reportParticipants, true) as Array<
8767+
return getMoneyRequestOptions(report, policy, reportParticipants, true, isReportArchived) as Array<
87718768
Exclude<IOUType, typeof CONST.IOU.TYPE.REQUEST | typeof CONST.IOU.TYPE.SEND | typeof CONST.IOU.TYPE.CREATE | typeof CONST.IOU.TYPE.SPLIT_EXPENSE>
87728769
>;
87738770
}
@@ -8982,14 +8979,14 @@ function getReportOfflinePendingActionAndErrors(report: OnyxEntry<Report>): Repo
89828979
/**
89838980
* Check if the report can create the expense with type is iouType
89848981
*/
8985-
function canCreateRequest(report: OnyxEntry<Report>, policy: OnyxEntry<Policy>, iouType: ValueOf<typeof CONST.IOU.TYPE>): boolean {
8982+
function canCreateRequest(report: OnyxEntry<Report>, policy: OnyxEntry<Policy>, iouType: ValueOf<typeof CONST.IOU.TYPE>, isReportArchived = false): boolean {
89868983
const participantAccountIDs = Object.keys(report?.participants ?? {}).map(Number);
89878984

89888985
if (!canUserPerformWriteAction(report)) {
89898986
return false;
89908987
}
89918988

8992-
const requestOptions = getMoneyRequestOptions(report, policy, participantAccountIDs);
8989+
const requestOptions = getMoneyRequestOptions(report, policy, participantAccountIDs, isReportArchived);
89938990
requestOptions.push(CONST.IOU.TYPE.CREATE);
89948991

89958992
return requestOptions.includes(iouType);

0 commit comments

Comments
 (0)