-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CP Staging] Revert "fix: distance - share with accountant" #54076
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
import isEmpty from 'lodash/isEmpty'; | ||
import Onyx from 'react-native-onyx'; | ||
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; | ||
import CONST from '@src/CONST'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import type {PolicyTagLists, Report, ReportAction} from '@src/types/onyx'; | ||
import type {PolicyTagLists, ReportAction} from '@src/types/onyx'; | ||
import * as CurrencyUtils from './CurrencyUtils'; | ||
import DateUtils from './DateUtils'; | ||
import * as Localize from './Localize'; | ||
import Log from './Log'; | ||
import * as PolicyUtils from './PolicyUtils'; | ||
import * as ReportActionsUtils from './ReportActionsUtils'; | ||
// eslint-disable-next-line import/no-cycle | ||
import {buildReportNameFromParticipantNames, getPolicyExpenseChatName, getPolicyName, getRootParentReport, isPolicyExpenseChat} from './ReportUtils'; | ||
import * as ReportConnection from './ReportConnection'; | ||
Check failure on line 12 in src/libs/ModifiedExpenseMessage.ts
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We also completely removed ReportConnection from App here, so we need to use an Onyx connection for that |
||
import * as TransactionUtils from './TransactionUtils'; | ||
|
||
let allPolicyTags: OnyxCollection<PolicyTagLists> = {}; | ||
|
@@ -27,13 +25,6 @@ | |
}, | ||
}); | ||
|
||
let allReports: OnyxCollection<Report>; | ||
Onyx.connect({ | ||
key: ONYXKEYS.COLLECTION.REPORT, | ||
waitForCollectionCallback: true, | ||
callback: (value) => (allReports = value), | ||
}); | ||
|
||
/** | ||
* Utility to get message based on boolean literal value. | ||
*/ | ||
|
@@ -135,20 +126,6 @@ | |
}); | ||
} | ||
|
||
function getForExpenseMovedFromSelfDM(destinationReportID: string) { | ||
const destinationReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${destinationReportID}`]; | ||
const rootParentReport = getRootParentReport(destinationReport); | ||
|
||
// The "Move report" flow only supports moving expenses to a policy expense chat or a 1:1 DM. | ||
const reportName = isPolicyExpenseChat(rootParentReport) ? getPolicyExpenseChatName(rootParentReport) : buildReportNameFromParticipantNames({report: rootParentReport}); | ||
const policyName = getPolicyName(rootParentReport, true); | ||
|
||
return Localize.translateLocal('iou.movedFromSelfDM', { | ||
reportName, | ||
workspaceName: !isEmpty(policyName) ? policyName : undefined, | ||
}); | ||
} | ||
|
||
/** | ||
* Get the report action message when expense has been modified. | ||
* | ||
|
@@ -159,13 +136,8 @@ | |
if (!ReportActionsUtils.isModifiedExpenseAction(reportAction)) { | ||
return ''; | ||
} | ||
|
||
const reportActionOriginalMessage = ReportActionsUtils.getOriginalMessage(reportAction); | ||
const policyID = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]?.policyID ?? '-1'; | ||
|
||
if (reportActionOriginalMessage?.movedToReportID) { | ||
return getForExpenseMovedFromSelfDM(reportActionOriginalMessage.movedToReportID); | ||
} | ||
const policyID = ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]?.policyID ?? '-1'; | ||
Check failure on line 140 in src/libs/ModifiedExpenseMessage.ts
|
||
|
||
const removalFragments: string[] = []; | ||
const setFragments: string[] = []; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conflict was here. We added this useEffect in the PR being reverted here. We then CPed this fix , which moved some things around.