-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[Suggested Follow-ups][R2] Disable onboarding completion list when landing in #admins #80707
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
e6557c9
ada48c2
9054c67
1512fac
0780b4e
0d26a8d
168c299
ac4365e
89062a3
08a4d5d
f7e128e
d6bcca5
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,7 +1,6 @@ | ||
| import {Str} from 'expensify-common'; | ||
| import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; | ||
| import Onyx from 'react-native-onyx'; | ||
| import {getOnboardingMessages} from '@libs/actions/Welcome/OnboardingFlow'; | ||
| import {WRITE_COMMANDS} from '@libs/API/types'; | ||
| // eslint-disable-next-line no-restricted-syntax | ||
| import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; | ||
|
|
@@ -176,13 +175,12 @@ describe('actions/Policy', () => { | |
| expect(reportAction.actorAccountID).toBe(ESH_ACCOUNT_ID); | ||
| } | ||
|
|
||
| // Following tasks are filtered in prepareOnboardingOnyxData: 'viewTour', 'addAccountingIntegration' and 'setupCategoriesAndTags' (-3) | ||
| const {onboardingMessages} = getOnboardingMessages(); | ||
| const expectedManageTeamDefaultTasksCount = onboardingMessages[CONST.ONBOARDING_CHOICES.MANAGE_TEAM].tasks.length - 3; | ||
| // We do not pass tasks to `#admins` channel in favour of backed generated followup-list | ||
| const expectedManageTeamDefaultTasksCount = 0; | ||
|
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. Can we also add test case of email having
Contributor
Author
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. actually this test result will not be affected by |
||
|
|
||
| // After filtering, two actions are added to the list =- signoff message (+1) and default create action (+1) | ||
| const expectedReportActionsOfTypeCreatedCount = 1; | ||
| const expectedSignOffMessagesCount = 1; | ||
| const expectedSignOffMessagesCount = 0; | ||
| expect(adminReportActions.length).toBe(expectedManageTeamDefaultTasksCount + expectedReportActionsOfTypeCreatedCount + expectedSignOffMessagesCount); | ||
|
|
||
| let reportActionsOfTypeCreatedCount = 0; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -449,6 +449,21 @@ describe('ReportUtils', () => { | |
| }); | ||
|
|
||
| describe('prepareOnboardingOnyxData', () => { | ||
| const REPORT_ID = '5'; | ||
| beforeEach(async () => { | ||
| Onyx.merge(ONYXKEYS.SESSION, {email: 'test+test@example.com'}); | ||
|
|
||
| const chatReport: Report = { | ||
| reportID: REPORT_ID, | ||
| type: CONST.REPORT.TYPE.CHAT, | ||
| participants: { | ||
| [CONST.ACCOUNT_ID.CONCIERGE]: {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS}, | ||
| [currentUserAccountID]: {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS}, | ||
| }, | ||
| }; | ||
| await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`, chatReport); | ||
| }); | ||
|
|
||
| it('provides test drive url to task title', () => { | ||
| const title = jest.fn(); | ||
|
|
||
|
|
@@ -509,6 +524,46 @@ describe('ReportUtils', () => { | |
| ); | ||
| }); | ||
|
|
||
| it('should not add anything to guidedSetupData when posting into the admin room', async () => { | ||
| const adminsChatReportID = '1'; | ||
| // Not having `+` in the email allows for `isPostingTasksInAdminsRoom` flow | ||
| await Onyx.merge(ONYXKEYS.SESSION, {email: 'test@example.com'}); | ||
|
Comment on lines
+527
to
+530
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. Can we also add test case of email having
Contributor
Author
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. added |
||
| await waitForBatchedUpdates(); | ||
|
|
||
| const result = prepareOnboardingOnyxData({ | ||
| introSelected: undefined, | ||
| engagementChoice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM, | ||
| onboardingMessage: { | ||
| message: 'This is a test', | ||
| tasks: [{type: CONST.ONBOARDING_TASK_TYPE.CONNECT_CORPORATE_CARD, title: () => '', description: () => '', autoCompleted: false, mediaAttributes: {}}], | ||
| }, | ||
| adminsChatReportID, | ||
| selectedInterestedFeatures: ['areCompanyCardsEnabled'], | ||
| companySize: CONST.ONBOARDING_COMPANY_SIZE.MICRO, | ||
| }); | ||
| expect(result?.guidedSetupData).toHaveLength(0); | ||
| expect(result?.optimisticData.filter((i) => i.key === `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${adminsChatReportID}`)).toHaveLength(0); | ||
| }); | ||
|
|
||
| it('should add guidedSetupData when email has a +', async () => { | ||
| const adminsChatReportID = '1'; | ||
| await waitForBatchedUpdates(); | ||
|
|
||
| const result = prepareOnboardingOnyxData({ | ||
| introSelected: undefined, | ||
| engagementChoice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM, | ||
| onboardingMessage: { | ||
| message: 'This is a test', | ||
| tasks: [{type: CONST.ONBOARDING_TASK_TYPE.CONNECT_CORPORATE_CARD, title: () => '', description: () => '', autoCompleted: false, mediaAttributes: {}}], | ||
| }, | ||
| adminsChatReportID, | ||
| selectedInterestedFeatures: ['areCompanyCardsEnabled'], | ||
| companySize: CONST.ONBOARDING_COMPANY_SIZE.MICRO, | ||
| }); | ||
| expect(result?.guidedSetupData).toHaveLength(3); | ||
| expect(result?.optimisticData.filter((i) => i.key === `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${adminsChatReportID}`)).toHaveLength(0); | ||
| }); | ||
|
|
||
| it('should not create tasks if the task feature is not in the selected interested features', () => { | ||
| const result = prepareOnboardingOnyxData({ | ||
| introSelected: undefined, | ||
|
|
||
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.
When
shouldUseFollowupsInsteadOfTasksis true (admins room in non‑production), this path skips adding the text/sign‑off report actions, but still setslastVisibleActionCreatedtotextCommentAction.created. That makes the admins report look like it has a new action even though no visible action exists, so the report can jump to the top/unread with an empty action list until backend followups arrive. Consider leavinglastVisibleActionCreatedunchanged (or only updating it when you actually insert the corresponding report action) in the followups path.Useful? React with 👍 / 👎.
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.
This makes sense to me since we don't create
textCommentActionoptimistically.