Skip to content
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

[HOLD for Payment 2024-09-02] [$250] Send invoice - Individual workspace is in 'Send from' field #46705

Closed
3 of 6 tasks
izarutskaya opened this issue Aug 2, 2024 · 23 comments
Closed
3 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@izarutskaya
Copy link

izarutskaya commented Aug 2, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: v9.0.16-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/cases/view/3073286
Email or phone of affected tester (no customers): [email protected]
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

Precondition: account has Individual workspace as default and at least one existing group workspace.

  1. FAB > Send invoice
  2. Enter amount > Next
  3. Choose a user

Expected Result:

The 'Send from' default workspace is one of listed sender's existing default workspaces.

Actual Result:

The 'Send from' default workspace is Individual workspace. When click on field, the list of sender's existing workspaces is displayed. But if you change the default workspace (one of group WS in OldDot), the individual WS is not displayed in the list.

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6559066_1722589049090.individual_ws.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0107661f51eb3a2eee
  • Upwork Job ID: 1821429613810291281
  • Last Price Increase: 2024-08-08
  • Automatic offers:
    • rojiphil | Reviewer | 103496757
    • nkdengineer | Contributor | 103496758
Issue OwnerCurrent Issue Owner: @rojiphil
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 2, 2024
Copy link

melvin-bot bot commented Aug 2, 2024

Triggered auto assignment to @adelekennedy (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.

@izarutskaya
Copy link
Author

We think this issue might be related to the #vip-bills.

@nyomanjyotisa
Copy link
Contributor

Proposal

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

Individual workspace is in 'Send from' field

What is the root cause of that problem?

We return the default policy on getPrimaryPolicy function without excluding the personal policy

function getPrimaryPolicy(activePolicyID?: OnyxEntry<string>): Policy | undefined {
const activeAdminWorkspaces = PolicyUtils.getActiveAdminWorkspaces(allPolicies);
const primaryPolicy: Policy | null | undefined = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID ?? '-1'}`];
return primaryPolicy ?? activeAdminWorkspaces[0];
}

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

return the first activeAdminWorkspaces if the type of default policy is personal

    if (primaryPolicy?.type === CONST.POLICY.TYPE.PERSONAL) {
        return activeAdminWorkspaces[0];
    }

What alternative solutions did you explore? (Optional)

Copy link
Contributor

github-actions bot commented Aug 2, 2024

true

@nkdengineer
Copy link
Contributor

Proposal

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

The 'Send from' default workspace is Individual workspace. When click on field, the list of sender's existing workspaces is displayed. But if you change the default workspace (one of group WS in OldDot), the individual WS is not displayed in the list.

What is the root cause of that problem?

We always set the default WS in the send invoice flow is the default WS if it exists without checking it is a personal WS or not

function getPrimaryPolicy(activePolicyID?: OnyxEntry<string>): Policy | undefined {
const activeAdminWorkspaces = PolicyUtils.getActiveAdminWorkspaces(allPolicies);
const primaryPolicy: Policy | null | undefined = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID ?? '-1'}`];
return primaryPolicy ?? activeAdminWorkspaces[0];

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

Instead of getting primaryPolicy from allPolicies, we can get this policy from the activeAdminWorkspaces which already filtered the hidden policy

function getPrimaryPolicy(activePolicyID?: OnyxEntry<string>): Policy | undefined {
    const activeAdminWorkspaces = PolicyUtils.getActiveAdminWorkspaces(allPolicies);
    const primaryPolicy: Policy | null | undefined = activeAdminWorkspaces.find((policy) => policy.id === activePolicyID);
    return primaryPolicy ?? activeAdminWorkspaces[0];
}

function getPrimaryPolicy(activePolicyID?: OnyxEntry<string>): Policy | undefined {
const activeAdminWorkspaces = PolicyUtils.getActiveAdminWorkspaces(allPolicies);
const primaryPolicy: Policy | null | undefined = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID ?? '-1'}`];
return primaryPolicy ?? activeAdminWorkspaces[0];

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Aug 5, 2024
Copy link

melvin-bot bot commented Aug 5, 2024

@adelekennedy Whoops! This issue is 2 days overdue. Let's get this updated quick!

@adelekennedy
Copy link

I can't seem to recreate this on v9.0.16-5 - @izarutskaya can you still reproduce this?

@melvin-bot melvin-bot bot removed the Overdue label Aug 6, 2024
@adelekennedy adelekennedy added the External Added to denote the issue can be worked on by a contributor label Aug 8, 2024
@melvin-bot melvin-bot bot changed the title Send invoice - Individual workspace is in 'Send from' field [$250] Send invoice - Individual workspace is in 'Send from' field Aug 8, 2024
Copy link

melvin-bot bot commented Aug 8, 2024

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

@melvin-bot melvin-bot bot added Overdue Help Wanted Apply this label when an issue is open to proposals by contributors labels Aug 8, 2024
Copy link

melvin-bot bot commented Aug 8, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Aug 8, 2024
@rojiphil
Copy link
Contributor

@nkdengineer Is there any distinct advantage to your proposed solution compared to @nyomanjyotisa proposal here?
It seems like you are the doing the same thing but in a different way.

@nkdengineer
Copy link
Contributor

@rojiphil getActiveAdminWorkspaces function also filters out the WS that is pending deletion. If the default WS is pending deletion we should not show it as default in the send invoice. The proposal from @nyomanjyotisa doesn't cover this case (see the video below). For this case, we should use getActiveAdminWorkspaces as I mentioned in my proposal or update ONYXKEYS.NVP_ACTIVE_POLICY_ID when we delete the default WS.

Screen.Recording.2024-08-12.at.11.43.29.mov

@rojiphil
Copy link
Contributor

getActiveAdminWorkspaces function also filters out the WS that is pending deletion

Thanks. Using getActiveAdminWorkspaces for filtering make sense as it has the additional advantage.
@nkdengineer proposal LGTM
🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Aug 12, 2024

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 12, 2024
Copy link

melvin-bot bot commented Aug 12, 2024

📣 @rojiphil 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Aug 12, 2024

📣 @nkdengineer 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Aug 13, 2024
@nkdengineer
Copy link
Contributor

@rojiphil this PR is ready for review

@melvin-bot melvin-bot bot added Monthly KSv2 and removed Weekly KSv2 labels Sep 5, 2024
Copy link

melvin-bot bot commented Sep 5, 2024

This issue has not been updated in over 15 days. @rojiphil, @thienlnam, @adelekennedy, @nkdengineer eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@rojiphil
Copy link
Contributor

rojiphil commented Sep 5, 2024

@adelekennedy Looks like the automation did not work here.
This issue is due for payment as the fix has been in production since the last 2 weeks as mentioned here

@adelekennedy adelekennedy changed the title [$250] Send invoice - Individual workspace is in 'Send from' field [HOLD for Payment 2024-09-02] [$250] Send invoice - Individual workspace is in 'Send from' field Sep 6, 2024
@adelekennedy adelekennedy added the Awaiting Payment Auto-added when associated PR is deployed to production label Sep 6, 2024
@adelekennedy
Copy link

adelekennedy commented Sep 6, 2024

Payouts due:

Sorry about that! Updated title and moving forward with payments

  • Contributor: $250 @nkdengineer
  • Contributor+: $250 @rojiphil, @rojiphil it looks like the offer is still pending in the Upwork job am I looking at this wrong, does something need to be corrected or will you accept the offer?

Upwork job is here.

@adelekennedy
Copy link

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@rojiphil ] The PR that introduced the bug has been identified. Link to the PR:
  • [@rojiphil ] 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:
  • [@rojiphil ] A discussion in #expensify-bugs 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:
  • [@rojiphil ] Determine if we should create a regression test for this bug.
  • [@rojiphil ] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@adelekennedy ] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@rojiphil
Copy link
Contributor

  • [@rojiphil] The PR that introduced the bug has been identified. Link to the PR: Offending PR

  • [@rojiphil] 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: Added comment

  • [@rojiphil] A discussion in #expensify-bugs 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: Not Required. Existing checklist is good enough to capture such issues.

  • [@rojiphil] Determine if we should create a regression test for this bug. : Yes. We can

  • [@rojiphil] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

    1 FAB > Send invoice
    2 Enter amount > Next
    3 Choose a user
    4 Verify that: The 'Send from' default workspace is one of listed sender's existing default workspaces.
    5 Go offline
    6 Delete a workspace
    7 Repeat steps 1, 2, 3
    8 Verify that: the deleted workspace isn't in the list of workspaces

@rojiphil
Copy link
Contributor

  • $250 @rojiphil, @rojiphil it looks like the offer is still pending in the Upwork job am I looking at this wrong, does something need to be corrected or will you accept the offer?

@adelekennedy Completed BZ checklist and accepted offer too. Awaiting payment. Thanks

@melvin-bot melvin-bot bot added Daily KSv2 and removed Monthly KSv2 labels Sep 13, 2024
@adelekennedy
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
Status: Done
Development

No branches or pull requests

6 participants