-
Notifications
You must be signed in to change notification settings - Fork 3.9k
fix: missing Create expense options #71871
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -725,7 +725,10 @@ function getOptionData({ | |
| // Assign the actor account ID from the last action when it’s a REPORT_PREVIEW action. | ||
| // to ensures that lastActorDetails.accountID is correctly set in case it's empty string | ||
| if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW && lastActorDetails) { | ||
| lastActorDetails.accountID = lastAction.actorAccountID; | ||
| lastActorDetails = { | ||
| ...lastActorDetails, | ||
| accountID: lastAction.actorAccountID, | ||
| }; | ||
|
Comment on lines
727
to
+731
Contributor
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 ended up removing this piece of code in #73220 More details: |
||
| } | ||
|
|
||
| const lastActorDisplayName = getLastActorDisplayName(lastActorDetails); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,8 @@ import ONYXKEYS from '@src/ONYXKEYS'; | |
| import type {PersonalDetailsList, Report, ReportAction, ViolationName} from '@src/types/onyx'; | ||
| import type {ReportCollectionDataSet} from '@src/types/onyx/Report'; | ||
| import {chatReportR14932} from '../../__mocks__/reportData/reports'; | ||
| import createRandomReportAction from '../utils/collections/reportActions'; | ||
| import getOnyxValue from '../utils/getOnyxValue'; | ||
| import * as LHNTestUtils from '../utils/LHNTestUtils'; | ||
| import * as TestHelper from '../utils/TestHelper'; | ||
| import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; | ||
|
|
@@ -407,6 +409,45 @@ describe('SidebarLinksData', () => { | |
| // Then the report should not disappear in the sidebar because we are in the focus mode | ||
| expect(getOptionRows()).toHaveLength(0); | ||
| }); | ||
|
|
||
| it('should not change the current user personal detail when a report with last action is REPORTPREVIEW is displayed', async () => { | ||
|
Contributor
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. Let's switch to |
||
| // Given the SidebarLinks are rendered. | ||
| LHNTestUtils.getDefaultRenderedSidebarLinks(); | ||
|
|
||
| const report: Report = { | ||
| ...createReport(undefined, [1, 2], undefined, undefined, undefined, true), | ||
| lastActorAccountID: 1, | ||
| lastMessageText: '123456', | ||
| }; | ||
|
|
||
| const lastReportAction: ReportAction = { | ||
| ...createRandomReportAction(2), | ||
| actionName: 'REPORTPREVIEW', | ||
| actorAccountID: 2, | ||
|
Comment on lines
+418
to
+426
Contributor
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. NAB: Can we please create variables to give names to these IDs? I think that makes it a lot more clear. For example, something like setting the last actor account ID to |
||
| message: [], | ||
| originalMessage: undefined, | ||
| person: [ | ||
| { | ||
| type: 'TEXT', | ||
| style: 'strong', | ||
| text: TEST_USER_LOGIN, | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| await initializeState({ | ||
| [`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`]: report, | ||
| }); | ||
|
|
||
| await waitForBatchedUpdatesWithAct(); | ||
|
|
||
| await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`, {[lastReportAction.reportActionID]: lastReportAction}); | ||
|
|
||
| await waitForBatchedUpdatesWithAct(); | ||
|
|
||
| const personalDetail = await getOnyxValue(ONYXKEYS.PERSONAL_DETAILS_LIST); | ||
|
Contributor
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. NAB: You verified that this fails without your fix, right? |
||
| expect(personalDetail?.[TEST_USER_ACCOUNT_ID]?.accountID).toBe(TEST_USER_ACCOUNT_ID); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Report that should NOT be included in the LHN', () => { | ||
|
|
||
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.
Not a blocker, but please add a comment explaining why it's important to create a copy of the object.