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

[$500] Domain Card - User can edit the date in expenses related to the assigned domain card #36616

Closed
4 of 6 tasks
lanitochka17 opened this issue Feb 15, 2024 · 53 comments
Closed
4 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Feb 15, 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: 1.4.42-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:
Email or phone of affected tester (no customers): [email protected]
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Open App or go to staging.new.expensify.com
  2. Log in with [email protected]
  3. Navigate to the workspace chat for "Domain Card tests - DO NOT DELETE"
  4. Verify there's a report that contains the expenses related to the assigned domain card
  5. Click on the report
  6. Verify you can see the individual expenses
  7. Click on a individual expense
  8. Verify the fields "Amount" and "Date" are not editable

Expected Result:

Fields "Amount" and "Date" are not editable

Actual Result:

User has access to edit the date.
(User receives an error after editing the date, but can try to do it)

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

Add any screenshot/video evidence

Bug6380969_1708019494480.Safari-Domain-Card-Date-Edit.1.mp4
Bug6380969_1708019494545.Desktop-Domain-Card-Date-Edit.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~010604e6d9dd675bc1
  • Upwork Job ID: 1758194441775136768
  • Last Price Increase: 2024-03-14
  • Automatic offers:
    • FitseTLT | Contributor | 0
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Feb 15, 2024
@melvin-bot melvin-bot bot changed the title Domain Card - User can edit the date in expenses related to the assigned domain card [$500] Domain Card - User can edit the date in expenses related to the assigned domain card Feb 15, 2024
Copy link

melvin-bot bot commented Feb 15, 2024

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

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

melvin-bot bot commented Feb 15, 2024

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

Copy link

melvin-bot bot commented Feb 15, 2024

Triggered auto assignment to @miljakljajic (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@lanitochka17
Copy link
Author

We think that this bug might be related to #vip-vsp
CC @quinthar

@FitseTLT
Copy link
Contributor

FitseTLT commented Feb 15, 2024

Proposal

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

Domain Card - User can edit the date in expenses related to the assigned domain card

What is the root cause of that problem?

The canEditFieldOfMoneyRequest logic doesn't align with the BE requirements to allow editing date field and it allows the edit of date field for domain card transaction unlike amount which is disabled as in here

App/src/libs/ReportUtils.ts

Lines 2162 to 2164 in 1c0d126

if (fieldToEdit === CONST.EDIT_REQUEST_FIELD.AMOUNT || fieldToEdit === CONST.EDIT_REQUEST_FIELD.CURRENCY) {
if (TransactionUtils.isCardTransaction(transaction)) {
return false;

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

We should add a code before here

if (fieldToEdit === CONST.EDIT_REQUEST_FIELD.AMOUNT || fieldToEdit === CONST.EDIT_REQUEST_FIELD.CURRENCY) {

if (fieldToEdit === CONST.EDIT_REQUEST_FIELD.DATE) {
        if (TransactionUtils.isCardTransaction(transaction)) {
            return false;
        }
    }

or change

if (fieldToEdit === CONST.EDIT_REQUEST_FIELD.AMOUNT || fieldToEdit === CONST.EDIT_REQUEST_FIELD.CURRENCY) {

to

    if (fieldToEdit === CONST.EDIT_REQUEST_FIELD.AMOUNT || fieldToEdit === CONST.EDIT_REQUEST_FIELD.CURRENCY || fieldToEdit === CONST.EDIT_REQUEST_FIELD.DATE) {

What alternative solutions did you explore? (Optional)

@allroundexperts
Copy link
Contributor

@miljakljajic Who can edit these fields? Is it that no one should edit these?

@wildan-m
Copy link
Contributor

wildan-m commented Feb 20, 2024

Could someone add me to the "Domain Card tests - DO NOT DELETE" group? Alternatively, how can we create the domain card? Can we use a fake card for this purpose?

[email protected]

@melvin-bot melvin-bot bot added the Overdue label Feb 21, 2024
Copy link

melvin-bot bot commented Feb 22, 2024

@miljakljajic, @allroundexperts Whoops! This issue is 2 days overdue. Let's get this updated quick!

Copy link

melvin-bot bot commented Feb 22, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@brandonhenry
Copy link
Contributor

Is this accepting proposals?

@allroundexperts
Copy link
Contributor

@brandonhenry Yes. @miljakljajic Bump on the above question 😄

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Feb 23, 2024
Copy link

melvin-bot bot commented Feb 27, 2024

@miljakljajic, @allroundexperts Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@miljakljajic
Copy link
Contributor

For non-reimbursable expenses no one should be able to edit the date or amount.

@melvin-bot melvin-bot bot removed the Overdue label Feb 27, 2024
Copy link

melvin-bot bot commented Feb 29, 2024

@miljakljajic @allroundexperts 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!

@melvin-bot melvin-bot bot added the Overdue label Feb 29, 2024
Copy link

melvin-bot bot commented Feb 29, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@brandonhenry
Copy link
Contributor

Proposal

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

The issue is that users are currently able to edit the date field in expenses related to the assigned domain card without receiving any error message in the UI, even though such edits should not be allowed. The desired behavior is for the UI to present an error message when a user attempts to edit the date, effectively preventing the edit from being submitted to the backend.

What is the root cause of that problem?

The root cause of this problem lies in the frontend logic, specifically within the EditRequestPage or related components handling the editing process. There is a missing validation step that should check if the transaction being edited is associated with a domain card and, if so, should prevent the edit and display an appropriate error message to the user.

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

To resolve this issue, we need to implement a validation mechanism within the frontend that:

  1. Detects when a user attempts to edit the date field of a transaction related to a domain card.
  2. Prevents the edit from being applied.
  3. Displays an error message to the user explaining that editing the date for domain card transactions is not permitted.

This could be achieved by enhancing the existing edit handling logic in the EditRequestPage component or wherever the edit logic is currently implemented. Specifically, we can add a condition to the event handler responsible for saving edits that checks if the transaction is related to a domain card and if the field being edited is the date. If both conditions are met, the function should prevent the edit and trigger an error message instead of proceeding with the save operation.

Here is a conceptual code snippet to illustrate the proposed enhancement:

// Assuming this function is called when the user attempts to save their edits
function onSaveEdit(field, newValue) {
    // Check if the field being edited is the date and if the transaction is for a domain card
    if (field === 'Date' && isDomainCardTransaction(transaction)) {
        // Prevent the save and display an error message
        showError('Editing the date for domain card transactions is not allowed.');
        return;
    }

    // Proceed with saving the edit if the above conditions are not met
    saveEdit(field, newValue);
}

// Utility function to determine if a transaction is related to a domain card
function isDomainCardTransaction(transaction) {
    // Implementation depends on how domain card transactions are identified
    // This could involve checking the transaction's properties, associated policy, etc.
}

// Function to display error messages to the user
function showError(message) {
    // Implementation depends on how errors are displayed in the UI
    // This could involve setting state to trigger a modal, toast, or inline error message
}

If this makes sense, I can provide specific areas

@wildan-m
Copy link
Contributor

wildan-m commented Mar 1, 2024

Proposal

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

Some card fields in expenses related to the card are editable (Date) and interactive (Card).

I think in addition to being non-editable, it should also be non-interactive. What does that mean? If hovered/clicked, they shouldn't display a hand cursor or change to a hover style.

Current state:

GMT20240301-152519_Clip_Wildan.M.s.Clip.03_01_2024.mp4

Suggested revision:

GMT20240301-152714_Clip_Wildan.M.s.Clip.03_01_2024.mp4

What is the root cause of that problem?

We are not included CONST.EDIT_REQUEST_FIELD.DATE to this check

App/src/libs/ReportUtils.ts

Lines 2180 to 2184 in 5d2933d

if (fieldToEdit === CONST.EDIT_REQUEST_FIELD.AMOUNT || fieldToEdit === CONST.EDIT_REQUEST_FIELD.CURRENCY) {
if (TransactionUtils.isCardTransaction(transaction)) {
return false;
}

And not disable interactive in card menu item:

{isCardTransaction && (
<OfflineWithFeedback pendingAction={getPendingFieldAction('cardID')}>
<MenuItemWithTopDescription
description={translate('iou.card')}
title={cardProgramName}
titleStyle={styles.flex1}
/>
</OfflineWithFeedback>
)}

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

Change this line to.

    if (fieldToEdit === CONST.EDIT_REQUEST_FIELD.AMOUNT || fieldToEdit === CONST.EDIT_REQUEST_FIELD.CURRENCY || fieldToEdit === CONST.EDIT_REQUEST_FIELD.DATE) {
        if (TransactionUtils.isCardTransaction(transaction)) {
            return false;
        }

And add interactive={false} to this card menu item.

                {isCardTransaction && (
                    <OfflineWithFeedback pendingAction={getPendingFieldAction('cardID')}>
                        <MenuItemWithTopDescription
                            description={translate('iou.card')}
                            title={cardProgramName}
                            titleStyle={styles.flex1}
                            interactive={false}
                        />
                    </OfflineWithFeedback>
                )}

What alternative solutions did you explore? (Optional)

Copy link

melvin-bot bot commented Mar 4, 2024

@miljakljajic, @allroundexperts Eep! 4 days overdue now. Issues have feelings too...

@FitseTLT
Copy link
Contributor

PR ready

@trjExpensify
Copy link
Contributor

@miljakljajic as a bug that doesn't block the release, I'm moving this into Polish on the project board.

@trjExpensify trjExpensify moved this from Release 1: Spring 2024 (May) to Polish in [#whatsnext] #wave-collect Apr 16, 2024
@miljakljajic
Copy link
Contributor

Thank you @trjExpensify

@FitseTLT
Copy link
Contributor

FitseTLT commented May 2, 2024

Can we please get a new C+ here? I think @allroundexperts is busy and the pr is stuck for weeks.

@allroundexperts
Copy link
Contributor

@FitseTLT The checklist is already complete. Apologies for the delay here. If I'm unable to complete the review by tomorrow, we can re-assign.

@allroundexperts
Copy link
Contributor

@FitseTLT I reviewed this yesterday and left some comments.

@melvin-bot melvin-bot bot added Monthly KSv2 and removed Weekly KSv2 labels May 27, 2024
Copy link

melvin-bot bot commented May 27, 2024

This issue has not been updated in over 15 days. @robertjchen, @miljakljajic, @allroundexperts, @FitseTLT 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!

@robertjchen robertjchen removed the Reviewing Has a PR in review label May 28, 2024
@robertjchen
Copy link
Contributor

Looks like the associated change was deployed- closing this out unless there are any other remaining items?

@github-project-automation github-project-automation bot moved this from Polish to Done in [#whatsnext] #wave-collect May 28, 2024
@robertjchen robertjchen added Daily KSv2 and removed Monthly KSv2 labels May 28, 2024
@FitseTLT
Copy link
Contributor

@robertjchen Payment hasn't been issued yet, so please re-open it. @miljakljajic Payment is overdue, can u please process the payment, the linked pr has been deployed to production three weeks ago. Thx

@robertjchen robertjchen reopened this May 29, 2024
@melvin-bot melvin-bot bot added the Overdue label May 31, 2024
Copy link

melvin-bot bot commented Jun 3, 2024

@robertjchen, @miljakljajic, @allroundexperts, @FitseTLT Huh... This is 4 days overdue. Who can take care of this?

Copy link

melvin-bot bot commented Jun 5, 2024

@robertjchen, @miljakljajic, @allroundexperts, @FitseTLT 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@miljakljajic
Copy link
Contributor

paid

@melvin-bot melvin-bot bot removed the Overdue label Jun 6, 2024
@allroundexperts
Copy link
Contributor

@miljakljajic Can we please have a payment summary here? Thanks!

@JmillsExpensify
Copy link

Reopening for payment summary.

@miljakljajic
Copy link
Contributor

@allroundexperts is owed 500 USD for work reviewing this PR.

@JmillsExpensify
Copy link

$500 approved for @allroundexperts

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 Engineering External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests

9 participants