Skip to content

[HOLD for payment 2024-02-07] [$500] Thread - "Join" button appear when user Leave thread #34820

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: 1.4.28-0
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
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Navigate to a conversation
  2. Start a thread and send some messages
  3. Click on the three dot menu and hit "Leave thread"

Expected Result:

User should navigate back to the parent conversation with no visual issues

Actual Result:

"Join" button appear when user Leave thread

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

Bug6347846_1705683544658.az_recorder_20240119_170154.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~012a09bc563f2546c1
  • Upwork Job ID: 1748398010896543744
  • Last Price Increase: 2024-01-19
  • Automatic offers:
    • s77rt | Reviewer | 28120092
    • DylanDylann | Contributor | 28120093

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 19, 2024
  2. melvin-bot commented on Jan 19, 2024

    @melvin-bot
  3. changed the title [-]Thread - "Join" button appear when user Leave thread[/-] [+][$500] Thread - "Join" button appear when user Leave thread[/+] on Jan 19, 2024
  4. melvin-bot commented on Jan 19, 2024

    @melvin-bot

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

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 19, 2024
  6. melvin-bot commented on Jan 19, 2024

    @melvin-bot

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

  7. lanitochka17 commented on Jan 19, 2024

    @lanitochka17
    Author

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

  8. ishpaul777 commented on Jan 19, 2024

    @ishpaul777
    Contributor

    Proposal

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

    "Join" button appear when user Leave thread

    What is the root cause of that problem?

    Below are the conditions that need to be met to show the join button, technically when user click leave thread all conditions meet and join button appears while we are navigating the user to the parent chat.

    const canJoin = canJoinOrLeave && !isWhisperAction && props.report.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN;
    const canLeave = canJoinOrLeave && ((isChatThread && props.report.notificationPreference.length) || isUserCreatedPolicyRoom || canLeaveRoom);

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

    We need to check if navigation is in progress, we can use useIsFocused hook to check if screen is focused, so join is not visible until user is redirected to the parent chat

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  9. abzokhattab commented on Jan 19, 2024

    @abzokhattab
    Contributor

    Proposal

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

    "Join" button appear when user Leave thread

    What is the root cause of that problem?

    when leaving a room we change the reportID optimistically to null

    reportID: null,

    and the join button is shown based on this condition:

    const canJoinOrLeave = (isChatThread && !isEmptyChat) || isUserCreatedPolicyRoom || canLeaveRoom;
    const canJoin = canJoinOrLeave && !isWhisperAction && props.report.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN;

    so when leaving a thread the isThreadChat falsely returns true while transitioning resulting in showing the join button.

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

    we can pass the isReportReadyForDisplay from the ReportScreen component as a prop with default value as false then update the condition that is responsible for showing the header tooltip:

    {canJoin && !isSmallScreenWidth && joinButton}

    to:

    {canJoin && !isSmallScreenWidth && joinButton && props.isReportReadyForDisplay}

    alternativly

    we can fix the isThreadChat function since it shouldn't return true for a report the user left, to fix it we need to fix the underlying isThread
    function to check if the current reportID exits:

        return Boolean(report?.reportID && report?.parentReportID && report?.parentReportActionID);
  10. paultsimura commented on Jan 19, 2024

    @paultsimura
    Contributor

    Proposal

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

    The navigation on leaving Thread is delayed

    What is the root cause of that problem?

    First of all, I'd like to stress out that the issue is not only with the "Join" button but with the skeleton view as well.
    This is happening because we do not explicitly pass the navigation command on leaving the thread in Report.leaveRoom() as opposed to the leaving room:

    App/src/libs/actions/Report.ts

    Lines 2169 to 2177 in 56fb814

    if (isWorkspaceMemberLeavingWorkspaceRoom) {
    const participantAccountIDs = PersonalDetailsUtils.getAccountIDsByLogins([CONST.EMAIL.CONCIERGE]);
    const chat = ReportUtils.getChatByParticipants(participantAccountIDs);
    if (chat?.reportID) {
    // We should call Navigation.goBack to pop the current route first before navigating to Concierge.
    Navigation.goBack(ROUTES.HOME);
    Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(chat.reportID));
    }
    }

    We wait until it's removed from Onyx, and then the user gets navigated automatically because the thread report no longer exists. And this moment between the report being deleted and the user being navigated is causing the behavior in this issue.

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

    We need to explicitly navigate the user to the parent report upon leaving the thread:

    if (isChatThread(report)) {
        Navigation.goBack(ROUTES.HOME);
        Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.parentReportID));
    } else if (isWorkspaceMemberLeavingWorkspaceRoom) {
            const participantAccountIDs = PersonalDetailsUtils.getAccountIDsByLogins([CONST.EMAIL.CONCIERGE]);
            const chat = ReportUtils.getChatByParticipants(participantAccountIDs);
            if (chat?.reportID) {
                // We should call Navigation.goBack to pop the current route first before navigating to Concierge.
                Navigation.goBack(ROUTES.HOME);
                Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(chat.reportID));
            }
    }

    Result:

    Screen.Recording.2024-01-19.at.19.00.15.mov

    What alternative solutions did you explore? (Optional)

  11. DylanDylann commented on Jan 20, 2024

    @DylanDylann
    Contributor

    Dupe of #31220

  12. 22 remaining items

  13. melvin-bot commented on Jan 31, 2024

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  14. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Jan 31, 2024
  15. changed the title [-][$500] Thread - "Join" button appear when user Leave thread[/-] [+][HOLD for payment 2024-02-07] [$500] Thread - "Join" button appear when user Leave thread[/+] on Jan 31, 2024
  16. melvin-bot commented on Jan 31, 2024

    @melvin-bot

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

  17. melvin-bot commented on Jan 31, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.34-1 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-02-07. 🎊

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

  18. melvin-bot commented on Jan 31, 2024

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

    • [@s77rt / @DylanDylann] The PR that introduced the bug has been identified. Link to the PR:
    • [@s77rt / @DylanDylann] 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:
    • [@s77rt / @DylanDylann] 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:
    • [@s77rt / @DylanDylann] Determine if we should create a regression test for this bug.
    • [@s77rt / @DylanDylann] 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.
    • [@lschurr] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  19. s77rt commented on Feb 2, 2024

    @s77rt
    Member
  20. lschurr commented on Feb 7, 2024

    @lschurr
    Contributor

    Payment summary:

  21. lschurr commented on Feb 7, 2024

    @lschurr
    Contributor

    This is complete.

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