You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2024-06-13] [$250] Distance rate can be deleted from 3-dot menu when there is only one rate #41594
Version Number: 1.4.70-0 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: Applause Internal Team Slack conversation:
Action Performed:
Precondition:
There is only one default distance rate in the workspace.
Go to staging.new.expensify.com
Go to Account settings > Workspaces > any workspace.
Go to Distance rates.
Go offline.
Add a distance rate,
Delete the default workspace rate (not the newly-added rate).
Click on the checkbox of the newly added distance rate.
Select Delete option from the dropdown.
Note that the distance rate cannot be deleted because there must be at least one distance rate.
Click on the distance rate row.
Delete it from the three-dot menu.
Expected Result:
App will show the same pop-up in Step 9 that the distance rate cannot be deleted as there is only one distance rate.
Actual Result:
Distance rate can be deleted from 3-dot menu when there is only one distance rate.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
@slafortune 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
changed the title [-]Distance rate can be deleted from 3-dot menu when there is only one rate[/-][+][$250] Distance rate can be deleted from 3-dot menu when there is only one rate[/+]on May 3, 2024
What changes do you think we should make in order to solve the problem?
Remove || !rate.enabled check because user should not be able to delete the receipt until there is one more rate with enabled state. Also, I think we should canDeleteRate and canDisableRate filter out the rates that has pending action value delete. We might also want to filter out the rates with pending action value add. If we are going to filter out rates with pending action value add then we would also need to update that in PolicyDistanceRatesPage.
Optionally, we can filter out as stated above without removing || !rate.enabled check
Also check for other policy pages that has similar functionality
What alternative solutions did you explore? (Optional)
Only change the canDisableRate condition to exclude the rates with pending action delete and also add if needed.
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:
[@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:
[@sobitneupane] 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:
[@sobitneupane] 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:
[@sobitneupane] Determine if we should create a regression test for this bug.
[@sobitneupane] 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.
[@slafortune / @kevinksullivan] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
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:
[@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:
[@sobitneupane] 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:
[@sobitneupane] Determine if we should create a regression test for this bug.
yes
[@sobitneupane] 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.
Activity
melvin-bot commentedon May 3, 2024
Triggered auto assignment to @slafortune (
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.m-natarajan commentedon May 3, 2024
@slafortune 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
m-natarajan commentedon May 3, 2024
We think that this bug might be related to #wave-collect - Release 1
melvin-bot commentedon May 3, 2024
Job added to Upwork: https://www.upwork.com/jobs/~0144c3fd2f5960b3c2
[-]Distance rate can be deleted from 3-dot menu when there is only one rate[/-][+][$250] Distance rate can be deleted from 3-dot menu when there is only one rate[/+]melvin-bot commentedon May 3, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (
External)Krishna2323 commentedon May 3, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Distance rate can be deleted from 3-dot menu when there is only one rate
What is the root cause of that problem?
The condition
canDeleteRateisn't correct.App/src/pages/workspace/distanceRates/PolicyDistanceRateDetailsPage.tsx
Lines 50 to 51 in 75b3863
What changes do you think we should make in order to solve the problem?
Remove
|| !rate.enabledcheck because user should not be able to delete the receipt until there is one more rate with enabled state. Also, I think we shouldcanDeleteRateandcanDisableRatefilter out the rates that has pending action valuedelete. We might also want to filter out the rates with pending action valueadd. If we are going to filter out rates with pending action valueaddthen we would also need to update that inPolicyDistanceRatesPage.Optionally, we can filter out as stated above without removing
|| !rate.enabledcheckAlso check for other policy pages that has similar functionality
What alternative solutions did you explore? (Optional)
Only change the
canDisableRatecondition to exclude the rates with pending actiondeleteand alsoaddif needed.47 remaining items
melvin-bot commentedon Jun 6, 2024
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:
slafortune commentedon Jun 13, 2024
@cretadn22 Paid ✔️
@sobitneupane can you please complete the checklist?
melvin-bot commentedon Jun 17, 2024
@tgolen, @slafortune, @sobitneupane, @cretadn22 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
tgolen commentedon Jun 19, 2024
bump @sobitneupane to complete the checklist, please.
sobitneupane commentedon Jun 20, 2024
Regression Test Proposal
Do we agree 👍 or 👎
sobitneupane commentedon Jun 20, 2024
#38237
#38237 (comment)
yes
#41594 (comment)
slafortune commentedon Jun 20, 2024
@sobitneupane C+ is due $250 via NewDot
JmillsExpensify commentedon Jun 22, 2024
$250 approved for @sobitneupane