Skip to content

Commit 2710191

Browse files
committed
migrate updateMoneyRequestDescription
1 parent 9105cc4 commit 2710191

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

config/eslint/eslint.seatbelt.tsv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@
831831
"../../src/libs/actions/IOU/TrackExpense.ts" "@typescript-eslint/no-unsafe-type-assertion" 2
832832
"../../src/libs/actions/IOU/TrackExpense.ts" "no-restricted-syntax" 2
833833
"../../src/libs/actions/IOU/UpdateMoneyRequest.ts" "@typescript-eslint/no-deprecated/buildNextStepNew" 1
834-
"../../src/libs/actions/IOU/UpdateMoneyRequest.ts" "@typescript-eslint/no-deprecated/getPolicyTagsData" 13
834+
"../../src/libs/actions/IOU/UpdateMoneyRequest.ts" "@typescript-eslint/no-deprecated/getPolicyTagsData" 12
835835
"../../src/libs/actions/IOU/UpdateMoneyRequest.ts" "@typescript-eslint/no-unsafe-type-assertion" 2
836836
"../../src/libs/actions/IOU/UpdateMoneyRequest.ts" "no-restricted-syntax" 1
837837
"../../src/libs/actions/IOU/index.ts" "@typescript-eslint/no-deprecated/getMoneyRequestPolicyTags" 1

src/libs/actions/IOU/UpdateMoneyRequest.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,7 @@ function updateMoneyRequestDescription({
10821082
parentReportNextStep,
10831083
hash,
10841084
delegateAccountID,
1085+
reportPolicyTags,
10851086
}: {
10861087
transactionID: string;
10871088
transactionThreadReport: OnyxEntry<OnyxTypes.Report>;
@@ -1096,6 +1097,7 @@ function updateMoneyRequestDescription({
10961097
parentReportNextStep: OnyxEntry<OnyxTypes.ReportNextStepDeprecated>;
10971098
hash?: number;
10981099
delegateAccountID: number | undefined;
1100+
reportPolicyTags: OnyxEntry<OnyxTypes.PolicyTagLists>;
10991101
}) {
11001102
const parsedComment = getParsedComment(comment);
11011103
const transactionChanges: TransactionChanges = {
@@ -1113,8 +1115,7 @@ function updateMoneyRequestDescription({
11131115
transactionChanges,
11141116
policy,
11151117
policyTagList,
1116-
// TODO: Replace getPolicyTagsData (https://github.com/Expensify/App/issues/72721) with useOnyx hook
1117-
reportPolicyTags: getPolicyTagsData(parentReport?.policyID),
1118+
reportPolicyTags,
11181119
policyCategories,
11191120
currentUserAccountIDParam,
11201121
currentUserEmailParam,

src/libs/actions/TransactionInlineEdit.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import type {
5454
Transaction,
5555
TransactionViolations,
5656
} from '@src/types/onyx';
57+
import {getPolicyTagsData} from './IOU';
5758
import {
5859
updateMoneyRequestAmountAndCurrency,
5960
updateMoneyRequestCategory,
@@ -320,10 +321,14 @@ function editTransactionMerchantInline(params: TransactionInlineEditParams, newM
320321
/** Updates the description of an expense from the Search results table or the Expense Report page. */
321322
function editTransactionDescriptionInline(params: TransactionInlineEditParams, newDescription: string) {
322323
const iouParams = getIouParamsForTransaction(params);
324+
// TODO: Replace getPolicyTagsData (https://github.com/Expensify/App/issues/72721) with useOnyx hook
325+
// eslint-disable-next-line @typescript-eslint/no-deprecated
326+
const reportPolicyTags = getPolicyTagsData(iouParams.parentReport?.policyID);
323327
updateMoneyRequestDescription({
324328
...iouParams,
325329
comment: newDescription,
326330
hash: params.hash,
331+
reportPolicyTags,
327332
});
328333
}
329334

src/pages/iou/request/step/IOURequestStepDescription.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ function IOURequestStepDescription({
5555
const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${report?.policyID}`);
5656
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(report?.parentReportID)}`);
5757
const [parentReportNextStep] = useOnyx(`${ONYXKEYS.COLLECTION.NEXT_STEP}${getNonEmptyStringOnyxID(report?.parentReportID)}`);
58+
const [reportPolicyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${getNonEmptyStringOnyxID(parentReport?.policyID)}`);
5859

5960
const [policyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${report?.policyID}`);
6061

@@ -153,6 +154,7 @@ function IOURequestStepDescription({
153154
isASAPSubmitBetaEnabled,
154155
parentReportNextStep,
155156
delegateAccountID,
157+
reportPolicyTags,
156158
});
157159
} else {
158160
setMoneyRequestDescription(transaction?.transactionID, newComment, isTransactionDraft, hasReceipt(transaction));

0 commit comments

Comments
 (0)