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

[$250] Track expense - Error submitting expense when workspace has disabled all workflow features #57002

Closed
8 tasks done
IuliiaHerets opened this issue Feb 18, 2025 · 10 comments
Closed
8 tasks done
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Feb 18, 2025

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: 9.1.0.0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Device used: Mac 15.0 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to Account settings > Workspaces.
  3. Create a new workspace.
  4. Go to Workflows (Enable it from More features page if it is not auto-enabled).
  5. Disable Delayed submission, Add approvals and Make or track payments.
  6. Go to self DM.
  7. Submit a manual expense to the self expense.
  8. Click Share it with my accountant.
  9. Enter merchant and click Create expense.
  10. On workspace chat, click on the expense.

Expected Result:

The expense will be submitted to the workspace chat without issue.

Actual Result:

App throws error after submitting the expense to the workspace chat.
It shows "Unexpected error submitting this expense. Please try again later."

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6746480_1739869275602.20250218_165217.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021891887287630155892
  • Upwork Job ID: 1891887287630155892
  • Last Price Increase: 2025-02-18
Issue OwnerCurrent Issue Owner: @alitoshmatov
@IuliiaHerets IuliiaHerets added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Feb 18, 2025
Copy link

melvin-bot bot commented Feb 18, 2025

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

@sakluger sakluger moved this to Bugs and Follow Up Issues in [#whatsnext] #expense Feb 18, 2025
@sakluger sakluger added the External Added to denote the issue can be worked on by a contributor label Feb 18, 2025
@melvin-bot melvin-bot bot changed the title Track expense - Error submitting expense when workspace has disabled all workflow features [$250] Track expense - Error submitting expense when workspace has disabled all workflow features Feb 18, 2025
Copy link

melvin-bot bot commented Feb 18, 2025

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 18, 2025
Copy link

melvin-bot bot commented Feb 18, 2025

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

@Themoonalsofall
Copy link
Contributor

Themoonalsofall commented Feb 18, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-02-21 03:58:57 UTC.

Proposal

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

Track expense - Error submitting expense when workspace has disabled all workflow features

What is the root cause of that problem?

When we Share it with my accountant but the workspace does not enable Make or track payments in Workflow page, there will be an error.

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

In case the action is share and the workspace does not have arePaymentsEnabled, we will hide that workspace from the participant selector.

if (shouldSeparateWorkspaceChat && newReportOption.isOwnPolicyExpenseChat && !newReportOption.private_isArchived) {
workspaceChats.push(newReportOption);
} else if (shouldSeparateSelfDMChat && newReportOption.isSelfDM) {

        if (shouldSeparateWorkspaceChat && newReportOption.isOwnPolicyExpenseChat && !newReportOption.private_isArchived) {
            if (!(action === CONST.IOU.ACTION.SHARE && !arePaymentsEnabled(getPolicy(newReportOption.policyID)))) {
                workspaceChats.push(newReportOption);
            }
        }

We can do the same with the case workspace is displayed in Recent

Screen.Recording.2025-02-21.at.12.55.37.mov

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

NA

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

@huult
Copy link
Contributor

huult commented Feb 19, 2025

Proposal

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

Error submitting expense when workspace has disabled all workflow features

What is the root cause of that problem?

When we disable all features of the workflow and share a tracked expense to that workspace, the backend responds with a 401 error, which is then displayed. However, if at least one of the three features is enabled, the issue does not occur.

Image

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

To resolve this issue, we need to show a modal informing the user that they are unable to share to their account if the workflow feature is not enabled.

Here is step to implement it:

1 Create new state to show/hide modal

 const [isUnableToShareToAccount, setIsUnableToShareToAccount] = useState(false);
  1. Import ConfirmModal with the danger prop

    <ConfirmModal
        title={'Unable to Share Expense'}
        isVisible={isUnableToShareToAccount}
        onConfirm={() => {
            setIsUnableToShareToAccount(false);
            Navigation.goBack();
        }}
        prompt={'This expense cannot be shared because the "Make or Track Payments" workflow is not enabled in your workspace settings.'}
        confirmText={'Got it'}
        shouldShowCancelButton={false}
        danger
    />
  1. Create a condition to check if none of the workflow features are enabled and the action is 'share', then show a modal to inform the user

add here:

    if (action === CONST.IOU.ACTION.SHARE) {
              if (
                  !(
                      policy?.areWorkflowsEnabled &&
                      (policy.approvalMode !== CONST.POLICY.APPROVAL_MODE.OPTIONAL ||
                          policy.autoReportingFrequency !== CONST.POLICY.AUTO_REPORTING_FREQUENCIES.INSTANT ||
                          policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO)
                  )
              ) {
                  setIsUnableToShareToAccount(true);

                  return;
              }
          }

We need to confirm the behavior with @Expensify/design. We can either disable the button, show a message, or navigate to the workflow page after clicking the 'Got it' button.

Test branch

Screen.Recording.2025-02-19.at.15.46.14.mp4

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

None

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

@alitoshmatov
Copy link
Contributor

@sakluger Can we make clear what is the expected result here. Technically the error is correct since workspace has disabled "Make or track payments" thus you cannot share your tracked expanse from self chat to this workspace. I think the issue is how should we handle this situation.

@alitoshmatov
Copy link
Contributor

@Themoonalsofall Can you write more details on your proposal, I am not sure what you meant there

@sakluger
Copy link
Contributor

sakluger commented Feb 21, 2025

@alitoshmatov I'm asking for clarification on expected behavior from my team (here's the Slack post)

@IuliiaHerets I noticed that the tester's account in the video is different from the account listed on the GH issue. I had been trying to search for logs using the email posted on the GH issue, and couldn't find anything - I would have saved a lot of time if the correct email had been added. Could you please make sure to use the correct tester email on each issue? Thanks!

@Themoonalsofall
Copy link
Contributor

@alitoshmatov I have updated my proposal with more details and added results.

@sakluger
Copy link
Contributor

After talking with the team, it looks like this is a super edge case issue that probably wouldn't ever happen for a real-world customer. Closing out 👍

@github-project-automation github-project-automation bot moved this from Bugs and Follow Up Issues to Done in [#whatsnext] #expense Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
Status: Done
Development

No branches or pull requests

5 participants