Skip to content

[HOLD for payment 2023-07-20] [$1000] [Attachment] shows in LHN even after close error message #19913

Closed

Description

@kavimuru

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Go to any chat
  2. send any corrupted file
  3. click on X button in Unexpected error message

Expected Result:

should not show [Attachment] in LHN

Actual Result:

in LHN still shows [Attachment] even after close error message

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.21-2
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
Notes/Photos/Videos: Any additional supporting documentation

Screen.Recording.2023-05-29.at.11.51.42.AM.mov
Recording.826.mp4

Expensify/Expensify Issue URL:
Issue reported by: @gadhiyamanan
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1685341334486499

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01da8eae4fb504ea71
  • Upwork Job ID: 1664682621010223104
  • Last Price Increase: 2023-06-23

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 31, 2023
  2. melvin-bot commented on May 31, 2023

    @melvin-bot

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

  3. melvin-bot commented on May 31, 2023

    @melvin-bot

    Bug0 Triage Checklist (Main S/O)

    • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
    • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
      • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
    • This bug is reproducible using the reproduction steps in the OP. S/O
      • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
      • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
    • This issue is filled out as thoroughly and clearly as possible
      • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
    • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
  4. therealsujitk commented on May 31, 2023

    @therealsujitk
    Contributor

    Proposal

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

    The last message in the LHN doesn't get updated when a report action is removed by the user due to an error.

    What is the root cause of that problem?

    The reason for this is that we are not updating the report's lastMessageText while deleting the report action in Onyx in the function below.

    /**
    * @param {String} reportID
    * @param {Object} reportAction
    */
    function clearReportActionErrors(reportID, reportAction) {
    if (reportAction.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) {
    // Delete the optimistic action
    Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {
    [reportAction.reportActionID]: null,
    });
    // If there's a linked transaction, delete that too
    const linkedTransactionID = ReportActionUtils.getLinkedTransactionID(reportID, reportAction.reportActionID);
    if (linkedTransactionID) {
    Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION}${linkedTransactionID}`, null);
    }
    return;
    }
    Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {
    [reportAction.reportActionID]: {
    errors: null,
    },
    });
    }

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

    To resolve this issue, we simply update the lastMessageText in this function just like we do while deleting a report action. This is what the function would look like,

    /**
     * @param {String} reportID
     * @param {Object} reportAction
     */
    function clearReportActionErrors(reportID, reportAction) {
        if (reportAction.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) {
            // Delete the optimistic action
            const optimisticReportAction = {
                [reportAction.reportActionID]: null,
            };
            // Update the report's last message
            const optimisticReport = {
                lastMessageText: '',
                lastVisibleActionCreated: '',
            };
    
            const lastMessageText = ReportActionsUtils.getLastVisibleMessageText(reportID, optimisticReportAction);
            if (lastMessageText.length > 0) {
                const lastVisibleActionCreated = ReportActionsUtils.getLastVisibleAction(reportID, optimisticReportAction).created;
                optimisticReport.lastMessageText = lastMessageText;
                optimisticReport.lastVisibleActionCreated = lastVisibleActionCreated;
            }
    
            Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, optimisticReport);
            Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, optimisticReportAction);
    
            // If there's a linked transaction, delete that too
            const linkedTransactionID = ReportActionsUtils.getLinkedTransactionID(reportID, reportAction.reportActionID);
            if (linkedTransactionID) {
                Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION}${linkedTransactionID}`, null);
            }
    
            return;
        }
    
        Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {
            [reportAction.reportActionID]: {
                errors: null,
            },
        });
    }

    Note: We could optimise this by creating a function in ReportActionsUtils.js to format the last message, this way we will only have to call getLastVisibleAction instead of getLastVisibleMessageText as well.

    What alternative solutions did you explore? (Optional)

    None.

  5. isabelastisser commented on Jun 2, 2023

    @isabelastisser
    Contributor

    I tried to reproduce it with multiple corrupt files and couldn't reproduce it. @kavimuru @mananjadhav, can you please attach the corrupt file you used to this issue? I would like to try it before dismissing the bug. Thanks!

  6. therealsujitk commented on Jun 2, 2023

    @therealsujitk
    Contributor

    @isabelastisser you can find it in the slack discussion, here's the link to the file. I'm still able to reproduce this in staging.

  7. isabelastisser commented on Jun 2, 2023

    @isabelastisser
    Contributor

    Thanks and yep, I can reproduce it!

  8. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jun 2, 2023
  9. changed the title [-] [Attachment] shows in LHN even after close error message[/-] [+][$1000] [Attachment] shows in LHN even after close error message[/+] on Jun 2, 2023
  10. melvin-bot commented on Jun 2, 2023

    @melvin-bot
  11. melvin-bot commented on Jun 2, 2023

    @melvin-bot

    Current assignee @isabelastisser is eligible for the External assigner, not assigning anyone new.

  12. 105 remaining items

  13. melvin-bot commented on Jul 13, 2023

    @melvin-bot

    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:

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

    @rushatgabhane
    Member

    Agree with @rojiphil #19913 (comment) that this qualifies for a bonus

  15. isabelastisser commented on Jul 21, 2023

    @isabelastisser
    Contributor

    The offers were sent in Upwork, please accept, and I will process the payments.

    @rushatgabhane, please complete the BZ checklist asap and I will close this issue. Thanks!

  16. gadhiyamanan commented on Jul 21, 2023

    @gadhiyamanan
    Contributor

    @isabelastisser offer accepted, thanks!

  17. rojiphil commented on Jul 21, 2023

    @rojiphil
    Contributor

    The offers were sent in Upwork, please accept, and I will process the payments.

    @isabelastisser Accepted Offer. Thanks.

  18. isabelastisser commented on Jul 21, 2023

    @isabelastisser
    Contributor

    Payments were processed in Upwork.

    C+ payment will be made via NewDot upon BZ checklist completion. cc @rushatgabhane

  19. rushatgabhane commented on Jul 23, 2023

    @rushatgabhane
    Member
    1. The PR that introduced the bug has been identified. Link to the PR: https://github.com/Expensify/App/pull/13118/files#diff-8afe5b71ee0436c21364148c86dadd640f2bff3e3d916addbb1f1f6f7e5b6a43

    2. 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/13118/files#r1271466486

    3. 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: Not required

    4. Determine if we should create a regression test for this bug. Sure

    5. 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

      1. Click on any chat-based report in LHN to view the report screen.
      2. Click on the actions button on the footer to show the actions menu.
      3. Click 'Add Attachment' and select the corrupted file as attached in the issue. (corrupt pdf download link)
      4. Click on the 'Send` button in the Attachment modal to send the attachment.
      5. Note that the sidebar screen in LHN for this chat report will show '[Attachment]'. Further, the 'Uploading Attachment' chat comes up in the chat report screen.
      6. Once the attachment upload fails due to the corrupt file, we will observe a failure comment with "Unexpected error..."
      7. At this time, verify that the sidebar screen in LHN for this chat report displays the last successful message instead of '[Attachment]'.
  20. rushatgabhane commented on Jul 23, 2023

    @rushatgabhane
    Member
  21. isabelastisser commented on Jul 24, 2023

    @isabelastisser
    Contributor

    [@isabelastisser] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

    https://github.com/Expensify/Expensify/issues/302488

    all set!

  22. JmillsExpensify commented on Jul 27, 2023

    @JmillsExpensify
    Contributor

    @isabelastisser Can you please summarize the appropriate individual payments for all parties involved in this issue? This is holding up @rushatgabhane's NewDot payments. More information on this compliance process in Slack.

  23. isabelastisser commented on Jul 31, 2023

    @isabelastisser
    Contributor

    Payment summary:

    Issue reported by @gadhiyamanan - $250
    C+ review @rushatgabhane - $1000 for review, $500 urgency bonus
    Issue fixed by @rojiphil - $1000 for accepted proposal, $500 urgency bonus

  24. JmillsExpensify commented on Jul 31, 2023

    @JmillsExpensify
    Contributor

    Reviewed details for @rushatgabhane. These details are accurate based on summary from Business Reviewer and are now approved for payment in NewDot.

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.DailyKSv2EngineeringInternalRequires API changes or must be handled by Expensify staff

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions