App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2024-12-11] [$250] Remove pinned SelfDM for new users with "introSelected": "newDotManageTeam"

Open danielrvidal opened this issue 1 year ago • 24 comments

Proposal: Remove pinned SelfDM for new users with "introSelected": "newDotManageTeam" (slack)

Background: We pinned the SelfDM to all user's cases, thinking it might give them a place to make notes and try submitting an expense to themselves before someone else. I think we left the SelfDM pinned for all users by default to see if it causes issues while seeing if some people might use it as intended. But I don’t think we’ve really seen that.

Problem: The SelfDM adds noise and confusion to users looking to get their team set up

Solution: Remove SelfDM from being pinned for users with this introSelection so they don’t see it unless they track an expense.

Below is what the LHN looks like today. We would not pin or show the SelfDM going forward. image

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021860980169165781817
  • Upwork Job ID: 1860980169165781817
  • Last Price Increase: 2024-11-25
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @mallenexpensify

danielrvidal avatar Nov 20 '24 16:11 danielrvidal

Job added to Upwork: https://www.upwork.com/jobs/~021860980169165781817

melvin-bot[bot] avatar Nov 25 '24 09:11 melvin-bot[bot]

Triggered auto assignment to Contributor-plus team member for initial proposal review - @suneox (External)

melvin-bot[bot] avatar Nov 25 '24 09:11 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

Remove pinned SelfDM for new users with "introSelected": "newDotManageTeam"

What is the root cause of that problem?

Improvement

What changes do you think we should make in order to solve the problem?

  1. We would need to introduce new prop selfDMReportID to completeOnboarding: https://github.com/Expensify/App/blob/51e25af3df2eef49c2ac87e0aef816099f9d3747/src/libs/actions/Report.ts#L3892

  2. We would also need to pass this prop to prepareOnboardingOptimisticData: https://github.com/Expensify/App/blob/51e25af3df2eef49c2ac87e0aef816099f9d3747/src/libs/actions/Report.ts#L3473

  3. Then In BaseOnboardingAccounting: https://github.com/Expensify/App/blob/51e25af3df2eef49c2ac87e0aef816099f9d3747/src/pages/OnboardingAccounting/BaseOnboardingAccounting.tsx#L38

we will get the self-dm reportID as follows and pass it to completeOnboarding here:

                    const selfDMReportID = useMemo(() => ReportUtils.findSelfDMReportID(), []);
                    
                    Report.completeOnboarding(
                        onboardingPurposeSelected,
                        CONST.ONBOARDING_MESSAGES[onboardingPurposeSelected],
                        undefined,
                        undefined,
                        onboardingAdminsChatReportID ?? undefined,
                        onboardingPolicyID,
                        undefined,
                        onboardingCompanySize,
                        userReportedIntegration,
                        undefined,
                        selfDMReportID,
                    );

Then in prepareOnboardingOptimisticData we need to optimistically set the isPinned to false in case the introSelected is newDotManageTeam:

    if(engagementChoice === CONST.ONBOARDING_CHOICES.MANAGE_TEAM) {
        optimisticData.push(
            {
                onyxMethod: Onyx.METHOD.MERGE,
                key: `${ONYXKEYS.COLLECTION.REPORT}${selfDMReportID}`,
                value: {
                    isPinned: false,
                },
            },
        )
    }

Note that BE changes will also be required in this case.

One question:

It would look a little weird that first we have the self-dm pinned and then if the choice is manage team we remove it, one thing i would propose is that when the account is created set isPinned to false while returning from backend, and then in prepareOnboardingOptimisticData we can check if engagementChoice !== CONST.ONBOARDING_CHOICES.MANAGE_TEAM and if this is true then set isPinned to true.

Note that this is only a suggestion, I can work with the originally expected result too

twilight2294 avatar Nov 25 '24 10:11 twilight2294

@JmillsExpensify can you please read the one question I wrote in my proposal and give feedback?

[!NOTE] @suneox just noting that the basic idea is the same whether you pass a prop or do it in the function itself, All the core idea is there in my proposal, also from https://github.com/Expensify/App/issues/52409#issuecomment-2473091092 , I hope the same logic is applied here, so i hope you will be fair while selecting the proposal as you were in that other issue🙏

twilight2294 avatar Nov 25 '24 10:11 twilight2294

Edited by proposal-police: This proposal was edited at 2024-11-25 14:44:40 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

Remove pinned SelfDM for new users with "introSelected": "newDotManageTeam"

What is the root cause of that problem?

We don't update the selfDM to unpinned after the onboarding is complete and backend also doesn't update it.

What changes do you think we should make in order to solve the problem?

In prepareOnboardingOptimisticData, we need to update selfDM to unpin in optimisticData and reset it in failureData if the engagementChoice is newDotManageTeam. We also need the same update on backend side in CompleteGuidedSetup API

const selfDMReportID = ReportUtils.findSelfDMReportID();
const selfDMReport = ReportConnection.getReport(selfDMReportID ?? '-1');

if (engagementChoice === CONST.ONBOARDING_CHOICES.MANAGE_TEAM) {
    optimisticData.push({
        onyxMethod: Onyx.METHOD.MERGE,
        key: `${ONYXKEYS.COLLECTION.REPORT}${selfDMReportID}`,
        value: {
            isPinned: false
        }
    })

    failureData.push({
        onyxMethod: Onyx.METHOD.MERGE,
        key: `${ONYXKEYS.COLLECTION.REPORT}${selfDMReportID}`,
        value: {
            isPinned: selfDMReport?.isPinned
        }
    })
}

https://github.com/Expensify/App/blob/ba655634cc568818761dddceeae97b3b4ef48d38/src/libs/actions/Report.ts#L3474

We need to always do this in prepareOnboardingOptimisticData because we also have another case completeOnboarding here with onboardingPurpose is newDotManageTeam here. This is the case that the new user is invited to a workspace before the first time login. In this case, the normal onboarding flow is skipped and the first time the user selects a payment method, the onboarding is completed in completePaymentOnboarding

https://github.com/Expensify/App/blob/ba655634cc568818761dddceeae97b3b4ef48d38/src/libs/actions/IOU.ts#L7415

What alternative solutions did you explore? (Optional)

We can unpin the selfDM by default from backend side and then update it to pinned if we select an onboardingPurpose isn't newDotManageTeam.

nkdengineer avatar Nov 25 '24 14:11 nkdengineer

Thank you for all the proposals.

We have a different solution from @twilight2294 proposal, which only handle use case complete OnboardingAccounting by adding a new prop. However, there are several other use cases, such as updating onboardingPurpose when completing OnboardingPersonalDetails or PaymentOnboarding at KYCWall.

@nkdengineer proposal identifies these additional use cases and suggests always retrieving the value from prepareOnboardingOptimisticData instead of passing props. Additionally, this proposal also handles reverting the value in failureData, which is LGTM.

Overall, we can proceed with @nkdengineer proposal.

🎀 👀 🎀 C+ reviewed

suneox avatar Nov 25 '24 16:11 suneox

Triggered auto assignment to @MonilBhavsar, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] avatar Nov 25 '24 16:11 melvin-bot[bot]

Thank you team! Looking forward to the PRs!

danielrvidal avatar Nov 25 '24 16:11 danielrvidal

Looks good to me. Once we have App draft up. I'll test backend PR and submit it for review

MonilBhavsar avatar Nov 26 '24 05:11 MonilBhavsar

❌ There was an error making the offer to @suneox for the Reviewer role. The BZ member will need to manually hire the contributor.

melvin-bot[bot] avatar Nov 26 '24 05:11 melvin-bot[bot]

❌ There was an error making the offer to @nkdengineer for the Contributor role. The BZ member will need to manually hire the contributor.

melvin-bot[bot] avatar Nov 26 '24 05:11 melvin-bot[bot]

@mallenexpensify something didn't work with the roles. Do you mind fixing?

danielrvidal avatar Nov 26 '24 22:11 danielrvidal

Triggered auto assignment to @puneetlath (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

melvin-bot[bot] avatar Nov 26 '24 23:11 melvin-bot[bot]

Current assignee @suneox is eligible for the External assigner, not assigning anyone new.

melvin-bot[bot] avatar Nov 26 '24 23:11 melvin-bot[bot]

hmm... not sure what's going on here, only guess is that Bug (nor NewFeature) wasn't added so that messed up automation. @puneetlath , I snagged this from you as BZ so i can monitor in case the "❌ There was an error making the offer to" is larger than just this one issue.

mallenexpensify avatar Nov 26 '24 23:11 mallenexpensify

Both PR's are in review now

MonilBhavsar avatar Nov 28 '24 08:11 MonilBhavsar

Yo yo! Noticed this in a FullStory session. I can reproduce it reliably, see below:

https://github.com/user-attachments/assets/064ab0ff-bbd6-438f-99fa-0cea7b4b3ea0

The selfDM appears, and then disappears which is pretty jarring. Is that because the auth PR is merged, but the frontend PR is still outstanding?

trjExpensify avatar Nov 29 '24 14:11 trjExpensify

Yes, App PR will fix this issue

MonilBhavsar avatar Dec 02 '24 04:12 MonilBhavsar

Great stuff, thanks for confirming!

trjExpensify avatar Dec 02 '24 11:12 trjExpensify

Reviewing label has been removed, please complete the "BugZero Checklist".

melvin-bot[bot] avatar Dec 04 '24 01:12 melvin-bot[bot]

The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.70-9 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

  • https://github.com/Expensify/App/pull/53193

If no regressions arise, payment will be issued on 2024-12-11. :confetti_ball:

For reference, here are some details about the assignees on this issue:

  • @suneox requires payment (Needs manual offer from BZ)
  • @nkdengineer requires payment (Needs manual offer from BZ)

melvin-bot[bot] avatar Dec 04 '24 01:12 melvin-bot[bot]

@suneox @mallenexpensify @suneox The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

melvin-bot[bot] avatar Dec 04 '24 01:12 melvin-bot[bot]

Hey team, migrated users are still having the self-DM pinned when this change should also have accounted for them. Do we need to update the logic?

flaviadefaria avatar Dec 09 '24 14:12 flaviadefaria

Hey team, migrated users are still having the self-DM pinned when this change should also have accounted for them. Do we need to update the logic?

I think we can incorporate the update logic into issue #53405.

suneox avatar Dec 10 '24 13:12 suneox

Payment Summary

Upwork Job

  • ROLE: @suneox paid $(AMOUNT) via Upwork (LINK)
  • ROLE: @nkdengineer paid $(AMOUNT) via Upwork (LINK)

BugZero Checklist (@mallenexpensify)

  • [ ] I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • [ ] I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1860980169165781817/hired)
  • [ ] I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • [ ] I have verified the payment summary above is correct

melvin-bot[bot] avatar Dec 11 '24 09:12 melvin-bot[bot]

BugZero Checklist:

  • [x] [Contributor] Classify the bug:
Bug classification

Source of bug:

  • [ ] 1a. Result of the original design (eg. a case wasn't considered)
  • [ ] 1b. Mistake during implementation
  • [ ] 1c. Backend bug
  • [x] 1z. Other: Improvement

Where bug was reported:

  • [ ] 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
  • [ ] 2b. Reported on staging (eg. found during regression or PR testing)
  • [ ] 2d. Reported on a PR
  • [x] 2z. Other: All enviroment

Who reported the bug:

  • [ ] 3a. Expensify user
  • [x] 3b. Expensify employee
  • [ ] 3c. Contributor
  • [ ] 3d. QA
  • [ ] 3z. Other:
  • [x] [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to comment: This is an improvement, so we don’t have an offending PR.

  • [x] [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

    Link to discussion: N/A

  • [x] [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again. N/A: It isn't an impactful bug

suneox avatar Dec 11 '24 15:12 suneox

Thank you! I’ve accepted an offer.

suneox avatar Dec 13 '24 04:12 suneox

@mallenexpensify TY, I applied to that job

nkdengineer avatar Dec 13 '24 18:12 nkdengineer

Contributor: @nkdengineer paid $250 via Upwork Contributor+: @suneox paid $250 via Upwork.

@nkdengineer Please accept the job and reply here once you have? upwork.com/jobs/~021860980169165781817

mallenexpensify avatar Dec 14 '24 00:12 mallenexpensify

@mallenexpensify Done!

nkdengineer avatar Dec 15 '24 08:12 nkdengineer