Skip to content

[$500] Thread - Unable to send a reply in thread after leaving the thread in offline mode #34424

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!


Version Number:
Reproducible in staging?:
Reproducible in production?:
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:
Slack conversation:

Action Performed:

  1. Go to workspace chat
  2. Go offline.
  3. Send a message and reply in thread.
  4. Leave the thread.
  5. Open the thread and send a reply again.

Expected Result:

User is able to send a reply in thread after leaving the thread in offline mode.

Actual Result:

User is unable to send a reply in thread after leaving the thread in offline mode.

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

Bug6339832_1705045271304.20240111_230544.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0190e8891c6eb5ad7c
  • Upwork Job ID: 1745748146336444416
  • Last Price Increase: 2024-01-26
  • Automatic offers:
    • mollfpr | Reviewer | 28143176
    • tienifr | Contributor | 28143177

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 12, 2024
  2. changed the title [-]Thread - Unable to send a reply in thread after leaving the thread in offline mode[/-] [+][$500] Thread - Unable to send a reply in thread after leaving the thread in offline mode[/+] on Jan 12, 2024
  3. melvin-bot commented on Jan 12, 2024

    @melvin-bot
  4. melvin-bot commented on Jan 12, 2024

    @melvin-bot

    Triggered auto assignment to @joekaufmanexpensify (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 12, 2024
  6. melvin-bot commented on Jan 12, 2024

    @melvin-bot

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

  7. tienifr commented on Jan 12, 2024

    @tienifr
    Contributor

    Proposal

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

    User is unable to send a reply in thread after leaving the thread in offline mode.

    What is the root cause of that problem?

    After leaving thread, we will delete the report along with report actions, that why if users want to visit again, we have to load it from BE -> In offline mode we just can see the loading page

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

    We should not delete the thread report/ report action after leaving thread, we just need to update the notification preference to not receive the notification.

    In leaveRoom function:

        const optimisticData: OnyxUpdate[] = [
            {
                onyxMethod: Onyx.METHOD.MERGE,
                key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
                value: {
                          notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN,
                      }
            },
        ];
    

    we need to update successfulData as well.

    Then navigate to the previous chat.

        if (isWorkspaceMemberLeavingWorkspaceRoom) {
    ...
    else{
            Navigation.goBack(ROUTES.HOME);
    }
    

    What alternative solutions did you explore? (Optional)

    NA

    Result

    Screen.Recording.2024-01-12.at.17.29.59.mov
  8. Tony-MK commented on Jan 15, 2024

    @Tony-MK
    Contributor

    Proposal

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

    Thread - Unable to send a reply inside of a thread after leaving the thread in offline mode

    What is the root cause of that problem?

    The canLeaveRoom function is used in the HeaderView component to display the leave room menu option.

    const isWorkspaceMemberLeavingWorkspaceRoom = lodashGet(props.report, 'visibility', '') === CONST.REPORT.VISIBILITY.RESTRICTED && isPolicyMember;
    threeDotMenuItems.push({
    icon: Expensicons.ChatBubbles,
    text: translate('common.leave'),
    onSelected: Session.checkIfActionIsAllowed(() => Report.leaveRoom(props.report.reportID, isWorkspaceMemberLeavingWorkspaceRoom)),
    });

    I believe solely using isWorkspaceMemberLeavingWorkspaceRoom to create a condition in the leaveRoom function for this PR #33053 was not a good idea.

    App/src/libs/actions/Report.ts

    Lines 2092 to 2097 in f268c39

    value: isWorkspaceMemberLeavingWorkspaceRoom
    ? {
    notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN,
    }
    : {
    reportID: null,

    This is because PR removes the report.ReportID from the onyx if isWorkspaceMemberLeavingWorkspaceRoom is false.
    Hence, threads are also affected.

    const isTransitioning = report && report.reportID !== reportIDFromPath;
    return reportIDFromPath !== '' && report.reportID && !isTransitioning;

    Therefore, isReportReadyForDisplay will always be false, and the ReportScreen will load infinitely.

    {isReportReadyForDisplay && !isLoadingInitialReportActions && !isLoading && (
    <ReportActionsView

    It is just not displaying the ReportActionsView component.

    Finally, the user can not reply because of the ReportFooter component over here.

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

    Part 1

    We will use the isChatThread function with the isWorkspaceMemberLeavingWorkspaceRoom variable to create a better condition.

    value: isWorkspaceMemberLeavingWorkspaceRoom

    Modify the above condition to something similar to the one below:

    value: isWorkspaceMemberLeavingWorkspaceRoom || isChatThread(report)
    

    App/src/libs/actions/Report.ts

    Lines 2152 to 2154 in f268c39

    API.write('LeaveRoom', parameters, {optimisticData, successData, failureData});
    if (isWorkspaceMemberLeavingWorkspaceRoom) {

    Part 2

    Finally, we create a new condition after API.write shown above.
    It will navigate the user back to the parent report.

    if (isChatThread(report)) {
        Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(report.parentReportID));
    }
    

    Question
    Is the navigating back part not supposed to happen for threads? 🤔
    I added part 2 in case it was needed.

    Result (macOS - Chrome)

    296661827-ba321858-6fd0-49de-8e87-2ecb0eda39ae.mov
  9. joekaufmanexpensify commented on Jan 15, 2024

    @joekaufmanexpensify
    Contributor

    Pending proposal reviews from @thesahindia

  10. 60 remaining items

  11. tienifr commented on Mar 1, 2024

    @tienifr
  12. joekaufmanexpensify commented on Mar 4, 2024

    @joekaufmanexpensify
    Contributor

    Got it. I'll take a look.

  13. joekaufmanexpensify commented on Mar 5, 2024

    @joekaufmanexpensify
    Contributor
  14. joekaufmanexpensify commented on Mar 6, 2024

    @joekaufmanexpensify
    Contributor

    We discussed and landed on the following:

    • @tienifr - $500 for contributor role, since you were hired for this job, wrote the PR, and the delay was on us internally. Paid via Upwork.
    • @mollfpr - $250 for C+, since you reviewed proposals, but did not do a full review. Paid via NewDot.
  15. joekaufmanexpensify commented on Mar 6, 2024

    @joekaufmanexpensify
    Contributor

    @tienifr $500 sent and contract ended!

  16. joekaufmanexpensify commented on Mar 6, 2024

    @joekaufmanexpensify
    Contributor

    @mollfpr please accept our offer so we can pay you.

  17. joekaufmanexpensify commented on Mar 6, 2024

    @joekaufmanexpensify
    Contributor

    I'm OOO the next two days, so we'll issue payment to @mollfpr on Monday (once you accept the offer).

  18. mollfpr commented on Mar 7, 2024

    @mollfpr
    Contributor

    Sorry for the late reply @joekaufmanexpensify I did manual request in NewDot.

  19. joekaufmanexpensify commented on Mar 11, 2024

    @joekaufmanexpensify
    Contributor

    Ah, all good. I canceled the offer in upwork, and updated my post above to clarify that you're being paid via NewDot.

  20. joekaufmanexpensify commented on Mar 11, 2024

    @joekaufmanexpensify
    Contributor

    Payment summary is here.

  21. joekaufmanexpensify commented on Mar 11, 2024

    @joekaufmanexpensify
    Contributor

    All set!

  22. JmillsExpensify commented on Mar 12, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @mollfpr based on this summary.

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions