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.56k stars 2.9k forks source link

Report fields and values don't get updated in Report if admin deletes them from workspace #48827

Closed carlosmiceli closed 3 weeks ago

carlosmiceli commented 2 months 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.30-19 Reproducible in staging?:Y Reproducible in production?:Y 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: Slack conversation:**

Action Performed:

Expected Result:

Report should update to show that fields were updated/deleted.

Actual Result:

Nothing changes in the member report, despite fields and values having changed for the workspace.

Workaround:

Unknown.

Platforms:

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

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/user-attachments/assets/0acad528-e111-455e-9935-bded2149ecdf

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @aimane-chnaif
melvin-bot[bot] commented 2 months ago

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

melvin-bot[bot] commented 2 months ago

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.

FitseTLT commented 2 months ago

Edited by proposal-police: This proposal was edited at 2024-09-09 22:04:40 UTC.

Proposal

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

Report fields and values don't get updated in Report if admin deletes them from workspace

What is the root cause of that problem?

We are using report Fields list here instead of policy field list https://github.com/Expensify/App/blob/1b479b0602158fea8eb427fb215a14a18926c58f/src/pages/EditReportFieldPage.tsx#L54 https://github.com/Expensify/App/blob/063cc10e7dc28ab99a2e659728202b1ea184db88/src/pages/EditReportFieldPage.tsx#L156 but when report fields are updated it is the policy fields lists that gets updated

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

We should use policy fields for options

    const policyField = policy?.fieldList?.[fieldKey] ?? reportField;

                    fieldOptions={policyField.values.filter((_value: string, index: number) => !policyField.disabledOptions[index])}

we can also consider updating the report fields values and other props as disabledOpitons to the policy field values on updateReportField

What alternative solutions did you explore? (Optional)

But we can also consider some more props other than values to be taken from policy field instead of report fields such as deletable defaultValue etc

cretadn22 commented 2 months ago

Proposal

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

Report fields and values don't get updated in Report if admin deletes them from workspace

What is the root cause of that problem?

When updating the report field, we only modify policy.reportField. However, on the EditReportFieldPage, we prioritize using report.reportField, which remains unchanged. https://github.com/Expensify/App/blob/1b479b0602158fea8eb427fb215a14a18926c58f/src/pages/EditReportFieldPage.tsx#L54

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

https://github.com/Expensify/App/blob/1b479b0602158fea8eb427fb215a14a18926c58f/src/pages/EditReportFieldPage.tsx#L54

Update to const reportField = policy?.fieldList?.[fieldKey] ?? report?.fieldList?.[fieldKey]; Or creating new variable to avoid affecting other features

Additionally, we only show the search bar when the list is empty.

9

We should display the empty view with the Edit button only for admins, similar to how we implemented it on the category page https://github.com/Expensify/App/blob/968b610b1cb3f46349ff50587d4a13948d1453b9/src/pages/iou/request/step/IOURequestStepCategory.tsx#L171-L199

What alternative solutions did you explore? (Optional)

FitseTLT commented 2 months ago

Sorry forgot to notify Updated

But note that my last update was hours before the other proposals above

aimane-chnaif commented 2 months ago

@FitseTLT's proposal looks good. 🎀👀🎀 C+ reviewed

melvin-bot[bot] commented 2 months ago

Current assignees @puneetlath and @carlosmiceli are eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

FitseTLT commented 1 month ago

@puneetlath payment overdue

melvin-bot[bot] commented 1 month ago

This issue has not been updated in over 15 days. @carlosmiceli, @puneetlath, @FitseTLT, @aimane-chnaif 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!

FitseTLT commented 1 month ago

@puneetlath can u pls issue the payment here? Thx!

puneetlath commented 1 month ago

Hm, seems there is no upwork job.

@FitseTLT offer here: https://www.upwork.com/nx/wm/offer/104341899 @aimane-chnaif offer here: https://www.upwork.com/nx/wm/offer/104341902

@aimane-chnaif can you please complete the checklist?

FitseTLT commented 1 month ago

@puneetlath offer accepted!

puneetlath commented 1 month ago

@FitseTLT has been paid. Just waiting on @aimane-chnaif.

aimane-chnaif commented 1 month ago

Offending PR with comment: https://github.com/Expensify/App/pull/36553#discussion_r1798815259

Regression Test Proposal

  1. Log in as the admin of a workspace in one window and a member in another.
  2. Go to workspace settings as admin.
  3. Go to the report fields section.
  4. Make sure there are list values on the workspace report fields.
  5. As a member, open an expense's report fields.
  6. As an admin, delete some values.
  7. Verify that report fields are deleted accordingly on member side.
puneetlath commented 1 month ago

@aimane-chnaif can you accept the offer: https://www.upwork.com/nx/wm/offer/104341902

aimane-chnaif commented 3 weeks ago

Accepted thanks

puneetlath commented 3 weeks ago

Paid!