Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.48k stars 2.83k forks source link

Rules - Default amounts are set when enabling Rules #50934

Open IuliiaHerets opened 21 hours ago

IuliiaHerets commented 21 hours ago

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.0.49-1 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?/tests/view/5090142 Email or phone of affected tester (no customers): dave0123seife@gmail.com Issue reported by: Applause Internal Team

Action Performed:

As the admin of a USD Control workspace that has never enabled Rules in the past

  1. Navigate to More Features in the workspace editor
  2. Enable Rules
  3. Navigate to the Rules page in WS editor

Expected Result:

When rules are first enabled no default will be set for Require receipt amount, Max expense amount, and Max expense age

Actual Result:

When rules are first enabled default is set for Require receipt amount, Max expense amount, and Max expense age

Workaround:

Unknown

Platforms:

Screenshots/Videos

Bug6636673_1729093025338!Screenshot_2024-10-16_at_6 35 12_in_the_evening

View all open jobs on GitHub

melvin-bot[bot] commented 21 hours ago

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

IuliiaHerets commented 21 hours ago

@zanyrenney FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

shahinyan11 commented 20 hours ago

Edited by proposal-police: This proposal was edited at 2024-10-16 19:12:55 UTC.

Proposal

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

Rules - Default amounts are set when enabling Rules

What is the root cause of that problem?

In upgradeToCorporate we set default values for maxExpenseAge , maxExpenseAmount and maxExpenseAmountNoReceipt in optimistic data and besides the backend returns those keys in UpgradeToCorporate request's response

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

Set the empty string for the. maxExpenseAge , maxExpenseAmount and maxExpenseAmountNoReceipt keys in optimisticData and successData in upgradeToCorporate

    const optimisticData: OnyxUpdate[] = [
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `policy_${policyID}`,
            value: {
                ...
                maxExpenseAge: '',
                maxExpenseAmount: '',
                maxExpenseAmountNoReceipt: '',
                ...
            },
        },
    ];

    const successData: OnyxUpdate[] = [
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `policy_${policyID}`,
            value: {
                maxExpenseAge: '',
                maxExpenseAmount: '',
                maxExpenseAmountNoReceipt: '',
                isPendingUpgrade: false,
            },
        },
    ];

What alternative solutions did you explore? (Optional)

  1. Update the values of those constants to empty string
  2. Add below keys in this successData
    maxExpenseAge: CONST.POLICY.DEFAULT_MAX_EXPENSE_AGE,
    maxExpenseAmount: CONST.POLICY.DEFAULT_MAX_EXPENSE_AMOUNT,
    maxExpenseAmountNoReceipt: CONST.POLICY.DEFAULT_MAX_AMOUNT_NO_RECEIPT,
FitseTLT commented 19 hours ago

Those values are default values; this seems expected for me.

DylanDylann commented 13 hours ago

@marcaaron I also think this is expectation. Could you help to confirm the expectation here?