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-08-13] [$250] mWeb - Workspace - In archived workspace, in iou details page sideways caret are shown for fields #45851

Closed
2 of 6 tasks
lanitochka17 opened this issue Jul 20, 2024 · 49 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

@lanitochka17
Copy link

lanitochka17 commented Jul 20, 2024

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: 9.0.10
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to https://staging.new.expensify.com/home

  2. Tap on a workspace chat

  3. Submit an expense entering all fields

  4. Navigate to LHN

  5. Tap profile icon -- workspaces -- workspace

  6. Tap on 3 dots icon next to workspace

  7. Delete the workspace

  8. Navigate to LHN

  9. Open the archived workspace chat

  10. Open the IOU

  11. Open amount and description field using sideways caret

  12. Note hhm not here page is shown

Expected Result:

Like in task details page, sideways caret must not be shown in iou details page in archived workspace

Actual Result:

In archived workspace, in iou details page sideways caret for amount & description field are shown directing to hhm not here page

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

Bug6547855_1721460264010.Screenrecorder-2024-07-20-12-37-14-543_compress_1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~019bd42da3fc0d7c59
  • Upwork Job ID: 1815412203411994715
  • Last Price Increase: 2024-07-22
  • Automatic offers:
    • dominictb | Contributor | 103308909
Issue OwnerCurrent Issue Owner: @joekaufmanexpensify
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 20, 2024
Copy link

melvin-bot bot commented Jul 20, 2024

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

@lanitochka17
Copy link
Author

@joekaufmanexpensify 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

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave-collect - Выпуск 1

@Krishna2323
Copy link
Contributor

Krishna2323 commented Jul 21, 2024

Proposal

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

mWeb - Workspace - In archived workspace, in iou details page sideways caret are shown for fields

What is the root cause of that problem?

  • We aren't checking for archived room in canEditMoneyRequest util function.

    function canEditMoneyRequest(reportAction: OnyxInputOrEntry<ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.IOU>>): boolean {

  • There is one more issue in isDeletedAction util function, it doesn't check if the action does has pending delete action.

    function isDeletedAction(reportAction: OnyxInputOrEntry<ReportAction | OptimisticIOUReportAction>): boolean {
    const message = reportAction?.message ?? [];
    if (!Array.isArray(message)) {
    return message?.html === '' ?? message?.deleted;
    }
    // A legacy deleted comment has either an empty array or an object with html field with empty string as value
    const isLegacyDeletedComment = message.length === 0 || message[0]?.html === '';
    return isLegacyDeletedComment || !!message[0]?.deleted;
    }

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

  • Add archived room check in canEditMoneyRequest and return false if repot is archived.
    if (isArchivedRoom(moneyRequestReport, getReportNameValuePairs(moneyRequestReport?.reportID))) {
        return false;
    }
  • Update isDeletedAction to also check for pending action and return true if reportAction?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE is true.
    if (!reportAction || reportAction?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) {
        return true;
    }

What alternative solutions did you explore? (Optional)

@dominictb
Copy link
Contributor

Proposal

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

  • In archived workspace, in iou details page sideways caret for amount & description field are shown directing to hhm not here page

What is the root cause of that problem?

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

                        interactive={canUserPerformWriteAction && canEditAmount && !readonly}
                        shouldShowRightIcon={canUserPerformWriteAction && canEditAmount}

with:

    const canUserPerformWriteAction = ReportUtils.canUserPerformWriteAction(report);

@Krishna2323
Copy link
Contributor

Proposal Updated

  • Found one more issue in isDeletedAction util function and added RCA and solution for that.

@joekaufmanexpensify
Copy link
Contributor

This doesn't seem to be happening only on Android. I reproduced it on Chrome web. I also don't think the task steps are necessary for reproducing. They help show that you can't edit fields on a task with an archived workspace, but I removed them from OP to make the bug easier to reproduce.

@joekaufmanexpensify
Copy link
Contributor

Makes sense to me that we wouldn't allow you to edit any fields on an expense when the workspace it's reported on is archived.

@joekaufmanexpensify joekaufmanexpensify added the External Added to denote the issue can be worked on by a contributor label Jul 22, 2024
@melvin-bot melvin-bot bot changed the title mWeb - Workspace - In archived workspace, in iou details page sideways caret are shown for fields [$250] mWeb - Workspace - In archived workspace, in iou details page sideways caret are shown for fields Jul 22, 2024
Copy link

melvin-bot bot commented Jul 22, 2024

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

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

melvin-bot bot commented Jul 22, 2024

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

@Tony-MK
Copy link
Contributor

Tony-MK commented Jul 23, 2024

Proposal

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

mWeb - Workspace - In archived workspace, in iou details page sideways caret are shown for fields

What is the root cause of that problem?

The root cause of the problem is that canEditMoneyRequest function will return true in this case when the policy is not found and isManager is true to allow the user to edit an expense report even if it is a state higher than OPEN (0).

App/src/libs/ReportUtils.ts

Lines 2717 to 2719 in 38cddee

// Admin & managers can always edit coding fields such as tag, category, billable, etc. As long as the report has a state higher than OPEN.
if ((isAdmin || isManager) && !isOpenExpenseReport(moneyRequestReport)) {
return true;

However, if the expense is not open, the canEditMoneyRequest function returns true to allow the user still to edit the description, category, or tag sections.

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

Let's check if the moneyRequestReport is not archived on the line.

return true;

return !isArchivedRoom(moneyRequestReport);

Just like how a user can not edit a task from an archived report.

Screen.Recording.2024-07-23.at.10.53.31.mov

@joekaufmanexpensify
Copy link
Contributor

Pending review of proposals

@hungvu193
Copy link
Contributor

I'll take a look tomorrow morning

@hungvu193

This comment has been minimized.

Copy link

melvin-bot bot commented Jul 24, 2024

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

@dominictb
Copy link
Contributor

dominictb commented Jul 24, 2024

@hungvu193 Any feedback about my solution? Using ReportUtils.canUserPerformWriteAction(report) will make the logic consistency and make sure we do not encounter similar issue in future. Thanks

@dominictb
Copy link
Contributor

@hungvu193 FYI, your selected proposal does not fix the case that the expense report failed to create like below:

Screen.Recording.2024-07-24.at.11.25.09.mov

or maybe I do not understand what that proposal's author means. Please correct me if I was wrong.

@hungvu193
Copy link
Contributor

Thanks for the information, IIRC we still allow user to edit information with error report.
Can you please confirm? @joekaufmanexpensify

@dominictb
Copy link
Contributor

FYI, I tried to edit any field in expense that has an error, and here is what BE returns:

image

@hungvu193
Copy link
Contributor

I see your point here, no need to discuss further, let wait for this confirmation. Thanks

@cristipaval
Copy link
Contributor

@hungvu193 please tag me again after you clarify. Thanks!

@dominictb
Copy link
Contributor

Will be ready in a few hours.

@joekaufmanexpensify
Copy link
Contributor

TY!

@dominictb
Copy link
Contributor

Still working on it. The PR will be ready shortly.

@joekaufmanexpensify
Copy link
Contributor

PR merged

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Aug 6, 2024
@melvin-bot melvin-bot bot changed the title [$250] mWeb - Workspace - In archived workspace, in iou details page sideways caret are shown for fields [HOLD for payment 2024-08-13] [$250] mWeb - Workspace - In archived workspace, in iou details page sideways caret are shown for fields Aug 6, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 6, 2024
Copy link

melvin-bot bot commented Aug 6, 2024

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

Copy link

melvin-bot bot commented Aug 6, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.16-8 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-08-13. 🎊

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

Copy link

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

  • [@hungvu193] The PR that introduced the bug has been identified. Link to the PR: Feat/dupe detection confirmation #42571 is not really the offending PR, we can treat this issue as an improvement.
  • [@hungvu193] 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: N/A
  • [@hungvu193] 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: N/A
  • [@hungvu193] Determine if we should create a regression test for this bug.
  • [@hungvu193] 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.
  • [@joekaufmanexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon: https://github.com/Expensify/Expensify/issues/420006

@joekaufmanexpensify
Copy link
Contributor

@hungvu193 could you complete BZ so we can prep for payment?

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Aug 12, 2024
@hungvu193
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: Feat/dupe detection confirmation #42571 is not really the offending PR, we can treat this issue as an improvement.
  • 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: N/A
  • 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: N/A
  • Determine if we should create a regression test for this bug: Yes

Regression test:

  1. Create an expense for any workspace.
  2. Go to that workspace and delete the workspace.
  3. Visit that expense again, click on that expense to open the detail page.
  4. Verify that you can not edit the expense information and the sideways caret aren't shown.

Do we 👍 or 👎 ?

@joekaufmanexpensify
Copy link
Contributor

Checklist is complete. TY!

@joekaufmanexpensify
Copy link
Contributor

All set to issue payment. We need to pay:

@joekaufmanexpensify
Copy link
Contributor

@dominictb $250 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

Upwork job closed.

@joekaufmanexpensify
Copy link
Contributor

Closing for now, since all that's left is for @hungvu193 to request payment via NewDot. Thanks everyone!

@JmillsExpensify
Copy link

$250 approved for @hungvu193

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
No open projects
Status: Done
Development

No branches or pull requests

8 participants