Skip to content

[HOLD for payment 2024-12-20] [$250] iOS - Report - Conversation does not scroll down after deleting an attachment #52861

Closed

Description

@lanitochka17

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.64-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5241542
Issue reported by: Applause - Internal Team

Action Performed:

  1. Open New Expensify app Hybrid
  2. Go to the conversation with the history of the message
  3. Send an image to the conversation
  4. Delete the sent image

Expected Result:

The conversation should scroll down after deleting the attachment

Actual Result:

Conversation does not scroll down after deleting an attachment

Workaround:

Unknown

Platforms:

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

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6671321_1732146742667.ScreenRecording_11-21-2024_04-47-49_1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021859628438339074230
  • Upwork Job ID: 1859628438339074230
  • Last Price Increase: 2024-12-05
Issue OwnerCurrent Issue Owner: @Pujan92

Activity

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

    @melvin-bot

    Triggered auto assignment to @puneetlath (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. bernhardoj commented on Nov 21, 2024

    @bernhardoj
    Contributor

    Proposal

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

    The chat doesn't scroll after deleting an attachment.

    What is the root cause of that problem?

    This happens because hasNewestReportAction is false.

    const shouldEnableAutoScroll = (hasNewestReportAction && (!reportActionID || !isNavigatingToLinkedMessage)) || (transactionThreadReport && !prevTransactionThreadReport);

    hasNewestReportAction compares the last action created with the report lastVisibleActionCreated.

    const hasNewestReportAction = reportActions.at(0)?.created === report.lastVisibleActionCreated || reportActions.at(0)?.created === transactionThreadReport?.lastVisibleActionCreated;

    When we delete the attachment, lastVisibleActionCreated is updated to the previous action created. However, the last action is still the deleted attachment.

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

    Currently, we have 2 places of hasNewestReportAction logic. If we look at the one in ReportActionsList, we can see that the report actions are filtered, so only visible actions will be considered the last action.

    const sortedVisibleReportActions = useMemo(
    () =>
    sortedReportActions.filter(
    (reportAction) =>
    (isOffline ||
    ReportActionsUtils.isDeletedParentAction(reportAction) ||
    reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE ||
    reportAction.errors) &&
    ReportActionsUtils.shouldReportActionBeVisible(reportAction, reportAction.reportActionID, ReportUtils.canUserPerformWriteAction(report)),
    ),
    [sortedReportActions, isOffline, report],
    );
    const lastAction = sortedVisibleReportActions.at(0);

    const hasNewestReportAction = lastAction?.created === lastVisibleActionCreated;

    So, the hasNewestReportAction in ReportActionList works correctly, but not in ReportActionsView. To fix this, we need to filter out the actions in ReportActionsView too. We can move the filtered actions from ReportActionsList

    const sortedVisibleReportActions = useMemo(
    () =>
    sortedReportActions.filter(
    (reportAction) =>
    (isOffline ||
    ReportActionsUtils.isDeletedParentAction(reportAction) ||
    reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE ||
    reportAction.errors) &&
    ReportActionsUtils.shouldReportActionBeVisible(reportAction, reportAction.reportActionID, ReportUtils.canUserPerformWriteAction(report)),
    ),
    [sortedReportActions, isOffline, report],
    );
    const lastAction = sortedVisibleReportActions.at(0);

    to ReportActionsView. Then, use it for hasNewestReportAction.

    const hasNewestReportAction = reportActions.at(0)?.created === report.lastVisibleActionCreated || reportActions.at(0)?.created === transactionThreadReport?.lastVisibleActionCreated;

    const visibleReportActions = useMemo(
        () => reportActions.filter(...),
        [reportActions, isOffline],
    );
    
    const hasNewestReportAction = visibleReportActions.at(0)?.created === report.lastVisibleActionCreated || visibleReportActions.at(0)?.created === transactionThreadReport?.lastVisibleActionCreated;
    

    Then, pass the filtered actions to ReportActionsList.

    <ReportActionsList
        sortedVisibleReportActions={visibleReportActions}
    

    we can consider moving the hasNewestReportAction from ReportActionsList to ReportActionsView too, so we only have 1 logic for it

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Nov 21, 2024
  5. changed the title [-]iOS - Report - Conversation does not scroll down after deleting an attachment[/-] [+][$250] iOS - Report - Conversation does not scroll down after deleting an attachment[/+] on Nov 21, 2024
  6. melvin-bot commented on Nov 21, 2024

    @melvin-bot
  7. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Nov 21, 2024
  8. melvin-bot commented on Nov 21, 2024

    @melvin-bot

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

  9. Pujan92 commented on Nov 22, 2024

    @Pujan92
    Contributor

    @puneetlath we can close this issue due to a similar issue has been created earlier and @bernhardoj can transfer their proposal there.

  10. bernhardoj commented on Nov 22, 2024

    @bernhardoj
    Contributor

    Based on the proposal there, looks like the root cause and solution is different.

  11. Pujan92 commented on Nov 22, 2024

    @Pujan92
    Contributor

    RCA of both issues looks similar to me where the issue remains in deriving the hasNewestReportAction due to the different values of last report action created and report lastVisibleActionCreated.

  12. bernhardoj commented on Nov 22, 2024

    @bernhardoj
    Contributor

    Yes, both issues are because of the wrong value of hasNewestReportAction, but the root cause and solution are still different. I tested my solution and the other issue still persists, so I can't transfer my proposal there because it won't fix that issue.

  13. 32 remaining items

  14. melvin-bot commented on Dec 13, 2024

    @melvin-bot

    @Pujan92 @Pujan92 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]

  15. melvin-bot commented on Dec 20, 2024

    @melvin-bot

    Issue is ready for payment but no BZ is assigned. @joekaufmanexpensify you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!

  16. melvin-bot commented on Dec 20, 2024

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@joekaufmanexpensify)

    • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1859628438339074230/hired)
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  17. joekaufmanexpensify commented on Dec 20, 2024

    @joekaufmanexpensify
    Contributor

    Asked in slack so we can get checklist done today.

  18. Pujan92 commented on Dec 20, 2024

    @Pujan92
    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:

    Regression Test Proposal

    1. Send an attachment to any chat
    2. Delete the attachment
    3. Verify the chat is scrolled to the bottom

    Do we agree 👍 or 👎

  19. joekaufmanexpensify commented on Dec 20, 2024

    @joekaufmanexpensify
    Contributor

    TY! I shared the regression test issue above, so checklist is all set.

  20. joekaufmanexpensify commented on Dec 20, 2024

    @joekaufmanexpensify
    Contributor

    Good to issue payment. We need to pay:

  21. joekaufmanexpensify commented on Dec 20, 2024

    @joekaufmanexpensify
    Contributor

    @Pujan92 / @bernhardoj please request payment at your earliest convenience. Closing as this is otherwise all set!

  22. bernhardoj commented on Dec 21, 2024

    @bernhardoj
    Contributor

    Requested in ND.

  23. garrettmknight commented on Dec 21, 2024

    @garrettmknight
    Contributor

    $250 approved for @Pujan92

  24. JmillsExpensify commented on Dec 23, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @bernhardoj

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