Skip to content

[HOLD for payment 2025-01-22] [$500] Expense - Submit button appears for archived workspace chat if delayed submission is enabled #49169

Closed

Description

@IuliiaHerets

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.33-4
Reproducible in staging?: Y
**Reproducible in production?:**Y
Email or phone of affected tester (no customers): nathanmulugetatesting+1469@gmail.com
Issue reported by: Applause Internal Team

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Sign up with a new Gmail account
  3. Create two workspaces
  4. Invite a member on the second workspace
  5. Enable workflows
  6. Enable delayed submission and make the frequency "Manually"
  7. Create an expense as the employee
  8. Delete the workspace as the admin

Expected Result:

Submit button doesn't show on the archived workspace chat on the expense

Actual Result:

Submit button shows on both the employee's and admin's archived workspace chat and clicking on the button results in an error

Additional Expected Behavior:

  1. When a workspace is deleted, no expense report should show Submit, Approve or Pay action buttons.
  2. Additionally Submit expense & Track expense options should be hidden from the expense report’s create menu (i.e the menu where Add attachment etc lives).

Workaround:

Unknown

Platforms:

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6602198_1726224396008.bandicam_2024-09-13_13-35-07-112.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021836147581047135142
  • Upwork Job ID: 1836147581047135142
  • Last Price Increase: 2024-10-24
  • Automatic offers:
    • FitseTLT | Contributor | 104580833
Issue OwnerCurrent Issue Owner: @johncschuster

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 13, 2024
  2. melvin-bot commented on Sep 13, 2024

    @melvin-bot

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

  3. IuliiaHerets commented on Sep 13, 2024

    @IuliiaHerets
    Author

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

  4. abzokhattab commented on Sep 13, 2024

    @abzokhattab
    Contributor

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

    Proposal

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

    Submit button appears for archived workspace chat if delayed submission is en bled

    What is the root cause of that problem?

    we dont disable the submit button if the workspce is archived here

    const shouldShowSubmitButton = isDraft && reimbursableSpend !== 0 && !allHavePendingRTERViolation;

    const shouldShowSubmitButton = isOpenExpenseReport && reimbursableSpend !== 0 && !showRTERViolationMessage;

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

    we should add another condition that the workspace is not deleted above using the isArchivedReport var

    or it could be added to the isOpenExpenseReport directly (to follow the same concept as in the isOpenTaskReport function) :

        return isExpenseReport(report) && !isArchivedRoomWithID(report?.reportID) && report?.stateNum === CONST.REPORT.STATE_NUM.OPEN && report?.statusNum === CONST.REPORT.STATUS_NUM.OPEN;

    POC

    Screen.Recording.2024-09-13.at.14.21.13.mov

    What alternative solutions did you explore? (Optional)

  5. etCoderDysto commented on Sep 13, 2024

    @etCoderDysto
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-10-17 10:27:58 UTC.

    Proposal

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

    Expense - Submit button appears for archived workspace chat if delayed submission is enabled

    What is the root cause of that problem?

    1. For submit button
      We display the button here even if the report is archived
      here

      const shouldShowSubmitButton = isDraft && reimbursableSpend !== 0 && !hasAllPendingRTERViolations;

      And here
      const shouldShowSubmitButton = isOpenExpenseReport && reimbursableSpend !== 0 && !showRTERViolationMessage;

    2. For Approve button we are already hiding the button when workspace is archived here
      Here we check if the workspace is archived

      const isArchivedReport = ReportUtils.isArchivedRoom(iouReport, reportNameValuePairs);

    Then we make shouldShowApproveButton button false if it is archived here

    const shouldShowApproveButton = useMemo(() => IOU.canApproveIOU(iouReport, policy), [iouReport, policy]);

    3. For Pay button we are already hiding the button if the workspace is archived
    Here we check if workspace is achieved
    const isChatReportArchived = ReportUtils.isArchivedRoom(chatReport, reportNameValuePairs);

    And we make canIOUBePaid false if the workspace is archived
    const canIOUBePaid = useMemo(() => getCanIOUBePaid(), [getCanIOUBePaid]);
    const onlyShowPayElsewhere = useMemo(() => !canIOUBePaid && getCanIOUBePaid(true), [canIOUBePaid, getCanIOUBePaid]);
    const shouldShowPayButton = isPaidAnimationRunning || canIOUBePaid || onlyShowPayElsewhere;
    const shouldShowApproveButton = useMemo(() => IOU.canApproveIOU(iouReport, policy), [iouReport, policy]);
    const shouldDisableApproveButton = shouldShowApproveButton && !ReportUtils.isAllowedToApproveExpenseReport(iouReport);
    const shouldShowSettlementButton = (shouldShowPayButton || shouldShowApproveButton) && !showRTERViolationMessage && !shouldShowBrokenConnectionViolation;

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

    1. For submit button We should hide the button when report is archived
      here
        const shouldShowSubmitButton = isDraft && reimbursableSpend !== 0 && !hasAllPendingRTERViolations && !isArchivedReport;
    
    

    And here

    const shouldShowSubmitButton = isOpenExpenseReport && reimbursableSpend !== 0 && !showRTERViolationMessage && !isArchivedReport;
    

    When a workspace is deleted, no expense report should show Submit, Approve or Pay action buttons.

    For approve and pay button we don't have to make any change since we already hiding the buttons when the workspace is archived.

    Additionally Submit expense & Track expense options should be hidden from the expense report’s create menu (i.e the menu where Add attachment etc lives).

    Currently the composer with all the submit, track expense option is closed when workspace chat is archived

    What alternative solutions did you explore? (Optional)

  6. etCoderDysto commented on Sep 13, 2024

    @etCoderDysto
    Contributor

    Note

    A kind reminder for C+:

    The fist section of the first proposal's permalink edit that points to shouldShowSubmitButton comes after my proposal. Prior to that it pointed to shouldDisableApproveButton.

    Screenshot of time of the first propsal Screenshot 2024-09-13 at 3 33 01 in the afternoon
    Screenshot of time my proposal Screenshot 2024-09-13 at 3 17 27 in the afternoon
  7. etCoderDysto commented on Sep 13, 2024

    @etCoderDysto
    Contributor

    Hi @abzokhattab. Writing few details takes time and make a difference in proposal submission time, and there seems to be a little difference between what you have suggested at first which is disabling the button (we dont disable the submit button ) by pointing a permalink to shouldDisableApproveButton, and what you suggested after the edit. That was why I raised the question. I have no ill intention towards you in saying that though🙏.

    Thanks!

  8. dominictb commented on Sep 14, 2024

    @dominictb
    Contributor

    Proposal

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

    • Submit button shows on both the employee's and admin's archived workspace chat and clicking on the button results in an error

    What is the root cause of that problem?

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

    • In general, we shouldn't show the submit button if the report is archived, pending deletion or encountered any error.

    All of these conditions can be handled in:

    function canUserPerformWriteAction(report: OnyxEntry<Report>) {

        const shouldShowSubmitButton = isDraft && reimbursableSpend !== 0 && !hasAllPendingRTERViolations && ReportUtils.canUserPerformWriteAction(moneyRequestReport);

    and

    const shouldShowSubmitButton = isOpenExpenseReport && reimbursableSpend !== 0 && !showRTERViolationMessage;

        const shouldShowSubmitButton = isOpenExpenseReport && reimbursableSpend !== 0 && !showRTERViolationMessage && ReportUtils.canUserPerformWriteAction(iouReport);

    What alternative solutions did you explore? (Optional)

  9. melvin-bot commented on Sep 16, 2024

    @melvin-bot

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

  10. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Sep 17, 2024
  11. melvin-bot commented on Sep 17, 2024

    @melvin-bot
  12. 109 remaining items

  13. melvin-bot commented on Jan 15, 2025

    @melvin-bot

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

  14. melvin-bot commented on Jan 15, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.85-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 2025-01-22. 🎊

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

  15. melvin-bot commented on Jan 15, 2025

    @melvin-bot

    @Ollyws @johncschuster @Ollyws The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  16. johncschuster commented on Jan 15, 2025

    @johncschuster
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] 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:

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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:

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal Template
    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Precondition:

    Test:

    Do we agree 👍 or 👎

  17. johncschuster commented on Jan 15, 2025

    @johncschuster
    Contributor

    Payment Summary

    Contributor: @FitseTLT paid $500 via Upwork
    Contributor+: @Ollyws owed $500 via NewDot

  18. johncschuster commented on Jan 22, 2025

    @johncschuster
    Contributor

    @Ollyws can you complete the BZ Checklist above?

  19. johncschuster commented on Jan 22, 2025

    @johncschuster
    Contributor

    Payment has been issued to @FitseTLT. Once the checklist is complete, please go ahead and request payment via ND, @Ollyws. Thank you!

  20. Ollyws commented on Jan 22, 2025

    @Ollyws
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production
    • 2b. Reported on staging (deploy blocker)
    • 2c. Reported on both staging and production
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] 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:

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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:

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal Template
    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Precondition:

    Test:

    1. Create a workspace from User A and enable workflow and manual submission
    2. Invite User B
    3. Submit an expense report from User B's account
    4. Remove User B from the workspace using User A's account
    5. From User B side open the archive workspace chat
    6. Open the expense report you submitted in (3)
    7. Verify that composer is visible (not hidden) and you can comment, all context menu work correctly like reply in thread, react.
    8. Verify that you can edit the expense fields like date, receipt, description, merchant, amount.
    9. Verify that you cannot submit (submit button doesn't appear)
    10. Verify that you cannot create expense on the archived expense report.
    

    Do we agree 👍 or 👎

  21. Ollyws commented on Jan 22, 2025

    @Ollyws
    Contributor

    Requested in ND.

  22. johncschuster commented on Jan 23, 2025

    @johncschuster
    Contributor

    Thanks, @Ollyws! We're good to close this up!

  23. garrettmknight commented on Jan 29, 2025

    @garrettmknight
    Contributor

    $500 approved for @Ollyws

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions