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-10-14] [$250] Custom report name - Delete option is present for Title report field but unable to delete it #49077

Closed
6 tasks done
izarutskaya opened this issue Sep 12, 2024 · 31 comments
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

Comments

@izarutskaya
Copy link

izarutskaya commented Sep 12, 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: 9.0.33-1
Reproducible in staging?: Y
Reproducible in production?: Y
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:

  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Rules.
  3. Enable Custom report name.
  4. Click Custom name.
  5. Clear the default value and enter random value.
  6. Save it.
  7. Go to workspace chat.
  8. Submit an expense.
  9. Go to expense report.
  10. Click on the Title report field.
  11. Click 3-dot menu > Delete.
  12. Click Delete.

Expected Result:

The Title report field should disappear after deleting it.

Actual Result:

Title report field remains after deleting it.
This issue only happens with Title report field that is enabled by Custom report name.

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

Bug6600629_1726120210498.20240912_134544.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021838887364204259850
  • Upwork Job ID: 1838887364204259850
  • Last Price Increase: 2024-09-25
  • Automatic offers:
    • c3024 | Reviewer | 104208803
Issue OwnerCurrent Issue Owner: @dylanexpensify
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 12, 2024
Copy link

melvin-bot bot commented Sep 12, 2024

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

@nyomanjyotisa
Copy link
Contributor

nyomanjyotisa commented Sep 12, 2024

Edited by proposal-police: This proposal was edited at 2024-09-12 13:33:49 UTC.

Proposal

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

Delete option is present for Title report field but unable to delete it

What is the root cause of that problem?

We should not show Delete option for title field base on this

But the following function not working properly, since we don't use any formula on the Custom name, but instead just a text without formula, the field type will be text. So it not return true in this function

App/src/libs/ReportUtils.ts

Lines 2720 to 2722 in 37161bc

function isReportFieldOfTypeTitle(reportField: OnyxEntry<PolicyReportField>): boolean {
return reportField?.type === 'formula' && reportField?.fieldID === CONST.REPORT_FIELD_TITLE_FIELD_ID;
}

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

Change the function to the following without checking the type

function isReportFieldOfTypeTitle(reportField: OnyxEntry<PolicyReportField>): boolean {
    return reportField?.fieldID === CONST.REPORT_FIELD_TITLE_FIELD_ID;
}

What alternative solutions did you explore? (Optional)

@daledah
Copy link
Contributor

daledah commented Sep 12, 2024

Proposal

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

Title report field remains after deleting it.
This issue only happens with Title report field that is enabled by Custom report name.

What is the root cause of that problem?

We're showing the policyReportFields from policy and report

const sortedPolicyReportFields = useMemo<PolicyReportField[]>((): PolicyReportField[] => {
const fields = ReportUtils.getAvailableReportFields(report, Object.values(policy?.fieldList ?? {}));
return fields.filter((field) => field.target === report.type).sort(({orderWeight: firstOrderWeight}, {orderWeight: secondOrderWeight}) => firstOrderWeight - secondOrderWeight);
}, [policy, report]);

const mergedFieldIds = Array.from(new Set([...policyReportFields.map(({fieldID}) => fieldID), ...reportFields.map(({fieldID}) => fieldID)]));

In this case, there's 1 reportField from policy and no one from report

But when users delete field, we don't clear it in policy (just clear fieldList in report)

App/src/libs/actions/Report.ts

Lines 1992 to 1999 in cfe3d36

key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
fieldList: {
[fieldKey]: null,
},
pendingFields: {
[fieldKey]: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
},

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

the reportField from policy shouldn't be deletable

update isReportFieldDeletable

to

    const isReportFieldFromReport = !!report?.fieldList?.[fieldKey]
    const isReportFieldDeletable = reportField.deletable && !isReportFieldTitle && isReportFieldFromReport

or we can just check isReportFieldDeletable = reportField.deletable && reportField?.fieldID !== CONST.REPORT_FIELD_TITLE_FIELD_ID

If we remove reportField?.type === 'formula' in isReportFieldOfTypeTitle function, it can affected a lot of places

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Sep 16, 2024
Copy link

melvin-bot bot commented Sep 17, 2024

@dylanexpensify Eep! 4 days overdue now. Issues have feelings too...

@dylanexpensify
Copy link
Contributor

reviewing today!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Sep 18, 2024
Copy link

melvin-bot bot commented Sep 23, 2024

@dylanexpensify Eep! 4 days overdue now. Issues have feelings too...

@daledah
Copy link
Contributor

daledah commented Sep 24, 2024

@dylanexpensify should we open this issue?

@dylanexpensify dylanexpensify added the External Added to denote the issue can be worked on by a contributor label Sep 25, 2024
Copy link

melvin-bot bot commented Sep 25, 2024

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

@melvin-bot melvin-bot bot changed the title Custom report name - Delete option is present for Title report field but unable to delete it [$250] Custom report name - Delete option is present for Title report field but unable to delete it Sep 25, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 25, 2024
Copy link

melvin-bot bot commented Sep 25, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Sep 25, 2024
@ivanmaurovic7
Copy link

ivanmaurovic7 commented Sep 25, 2024

How to login to [email protected]? App requires me to input a verification code.

Copy link

melvin-bot bot commented Sep 25, 2024

📣 @ivanmaurovic7! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@ivanmaurovic7
Copy link

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01be7ae4f41bd201bf

Copy link

melvin-bot bot commented Sep 25, 2024

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

Copy link

melvin-bot bot commented Sep 26, 2024

@dylanexpensify @c3024 this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@c3024
Copy link
Contributor

c3024 commented Sep 27, 2024

Asked for some clarification on Slack here.

@c3024
Copy link
Contributor

c3024 commented Sep 28, 2024

If the custom report name is a formula, it is shown as the report name in the header. However, when it is text, it is not shown in the header (because if it were, all reports would have the same title) and is instead displayed as a report field in the report view. This seems like expected behavior to me.

If we remove the formula check in isReportFieldOfTypeTitle, this behavior breaks. It will likely also break the expected behavior because this check is used in many other places. Therefore, I think checking with the field type as REPORT_FIELD_TITLE_FIELD_ID, as suggested in @daledah's proposal, looks good to me.

🎀 👀 🎀 C+ Reviewed

Copy link

melvin-bot bot commented Sep 28, 2024

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

@melvin-bot melvin-bot bot added the Overdue label Oct 1, 2024
@mjasikowski
Copy link
Contributor

@daledah looks good, thank you! We certainly don't want to remove the formula check at this point.

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

melvin-bot bot commented Oct 1, 2024

📣 @c3024 🎉 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 Oct 1, 2024

📣 @daledah You have been assigned to this job!
Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot removed the Overdue label Oct 1, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Oct 2, 2024
@daledah
Copy link
Contributor

daledah commented Oct 2, 2024

@c3024 PR is ready.

@dylanexpensify
Copy link
Contributor

pending deploy to prod then regression period

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 7, 2024
@melvin-bot melvin-bot bot changed the title [$250] Custom report name - Delete option is present for Title report field but unable to delete it [HOLD for payment 2024-10-14] [$250] Custom report name - Delete option is present for Title report field but unable to delete it Oct 7, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 7, 2024
Copy link

melvin-bot bot commented Oct 7, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Oct 7, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.45-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-10-14. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Oct 7, 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:

  • [@c3024] The PR that introduced the bug has been identified. Link to the PR:
  • [@c3024] 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:
  • [@c3024] 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:
  • [@c3024] Determine if we should create a regression test for this bug.
  • [@c3024] 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.
  • [@dylanexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@dylanexpensify
Copy link
Contributor

Coming up!

@c3024
Copy link
Contributor

c3024 commented Oct 15, 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:

  • [@c3024] The PR that introduced the bug has been identified. Link to the PR: feat: add delete option to deletable report fields #36039
  • [@c3024] 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: https://github.com/Expensify/App/pull/36039/files#r1800964733
  • [@c3024] 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: No discussion was started because this could not have been identified earlier.
  • [@c3024] Determine if we should create a regression test for this bug. Yes
  • [@c3024] 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.

Regression Test Proposal

  1. Go to Workspace Rules -> Enable Custom report name.
  2. Clear default custom name value and save a text value in the field
  3. Go to Workspace Chat -> Submit an expense
  4. Go to this expense report just submitted -> Click on the Title Report Field
  5. Verify that either
    -- there is no three dot menu in the right hand modal
    (or)
    -- if there is a three dot menu in the right hand modal, there is no Delete option in it.

@dylanexpensify
Copy link
Contributor

Payment summary:

Contributor: @daledah $250 via Upwork
Contributor+: @c3024 $250 via Upwork

Please apply/request!

@dylanexpensify
Copy link
Contributor

@daledah sent offer!

@dylanexpensify
Copy link
Contributor

Done!

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
Projects
None yet
Development

No branches or pull requests

7 participants