Skip to content

[$2000] Back from user details opens group chat instead of group details on android chrome #23935

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. Open the app in android chrome
  2. Open any group report
  3. Click on header to open details page
  4. Click on any user
  5. Click on "message %user%"
  6. Click back button in app and observe that it open group chat instead of group details page as we do on web chrome

Expected Result:

App should open group details page on back from user report if we open user report from group details page

Actual Result:

App opens group report instead of group details page on back from user report if we open user report from group details page on android chrome

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.47-3
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

android.chrome.wrong.back.user.details.mp4
az_recorder_20230731_122300.mp4

Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690437966940519

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01d267fead81e68c17
  • Upwork Job ID: 1687163869748379648
  • Last Price Increase: 2023-08-15

Activity

  1. added
    Daily
    Bug
    on Jul 31, 2023
  2. melvin-bot commented on Jul 31, 2023

    @melvin-bot

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

  3. melvin-bot commented on Jul 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. changed the title [-] Inconsistency bug: back from user details opens group chat instead of group details on android chrome[/-] [+]Back from user details opens group chat instead of group details on android chrome[/+] on Jul 31, 2023
  5. ygshbht commented on Jul 31, 2023

    @ygshbht
    Contributor

    Proposal

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

    The issue at hand involves incorrect navigation behavior in Android Chrome: the application returns to the group chat instead of the group details page after messaging a user from the details page.

    What is the root cause of that problem?

    The root cause of this problem lies in the navigateToAndOpenReportWithAccountIDs function. When this function is called upon clicking the 'message' button, it dismisses the current Right Hand Navigation (RHN) screen, causing it to be wiped from the navigation history. As a result, when the back button is pressed, the application doesn't navigate back to the group details page (as it's no longer in the history stack), and instead opens the group chat.

    function navigateToAndOpenReportWithAccountIDs(participantAccountIDs) {
    let newChat = {};
    const chat = ReportUtils.getChatByParticipants(participantAccountIDs);
    if (!chat) {
    newChat = ReportUtils.buildOptimisticChatReport(participantAccountIDs);
    }
    const reportID = chat ? chat.reportID : newChat.reportID;
    // We want to pass newChat here because if anything is passed in that param (even an existing chat), we will try to create a chat on the server
    openReport(reportID, [], newChat, '0', false, participantAccountIDs);
    Navigation.dismissModal(reportID);
    }

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

    To fix this issue, we should modify the navigateToAndOpenReportWithAccountIDs function to navigate to the new report route instead of dismissing it. This way, the RHN screen (group details page in this case) will be kept in the navigation history and we can navigate back to it when the back button is pressed. Here's the proposed code modification:

    function navigateToAndOpenReportWithAccountIDs(participantAccountIDs) {
        let newChat = {};
        const chat = ReportUtils.getChatByParticipants(participantAccountIDs);
        if (!chat) {
            newChat = ReportUtils.buildOptimisticChatReport(participantAccountIDs);
        }
        const reportID = chat ? chat.reportID : newChat.reportID;
    
        // We want to pass newChat here because if anything is passed in that param (even an existing chat), we will try to create a chat on the server
        openReport(reportID, [], newChat, '0', false, participantAccountIDs);
        Navigation.navigate(ROUTES.getReportRoute(reportID));
    }
    

    This fix, however, will highlight another issue: the inability to select the Left Hand Navigation (LHN) after the RHN is closed, due to an improperly positioned 'nodropzone' element. This will require a separate fix. The root cause of this issue should be investigated, and the position or behavior of the 'nodropzone' element should be adjusted accordingly to allow proper interaction with the LHN after the RHN is closed.
    #23885
    #23881

  6. jeet-dhandha commented on Jul 31, 2023

    @jeet-dhandha
    Contributor

    Proposal

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

    • On back from second report screen the profile page is not opened instead the first chat screen is opened.

    What is the root cause of that problem?

    • The modal is dismissed and then we are redirected to the second chat screen thus updating the root state to:
      • Home
      • CentralPanNavigator - (first chat)
      • CentralPanNavigator - (secon chat)

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

    1. We should add two params in navigateToAndOpenReportWithAccountIDs function

    /**
    * This will find an existing chat, or create a new one if none exists, for the given accountID or set of accountIDs. It will then navigate to this chat.
    *
    * @param {Array} participantAccountIDs of user logins to start a chat report with.
    */
    function navigateToAndOpenReportWithAccountIDs(participantAccountIDs) {

    Params:

    • shouldDismissModal - to dismiss the modal
    • pushToNavigationState - to push the navigation state to the root state
    1. Then we update the navigation code as based on above params.
    2. We add code to PUSH report to the navigation state if pushToNavigationState is true. (Refer below code if needed).
    Code Changes
    function navigateToAndOpenReportWithAccountIDs(participantAccountIDs, shouldDismissModal = true, pushToNavigationState = false) {
        ...rest code
        if (shouldDismissModal) {
            Navigation.dismissModal(reportID);
        }
    
        if (pushToNavigationState) {
            Navigation.navigate(ROUTES.getReportRoute(reportID), 'PUSH');
        }
    }
    1. Now we create a isSmallDevice constant which is basically this conditions Browser.isMobile() || isSmallScreenWidth and use it to decide whether to push the report to navigation state or not.

    2. Finally we update Report.navigateToAndOpenReportWithAccountIDs([accountID]) to Report.navigateToAndOpenReportWithAccountIDs([accountID], !isSmallDevice, isSmallDevice) in ProfilePage.js File.

    What alternative solutions did you explore? (Optional)

    • N/A
  7. ygshbht commented on Jul 31, 2023

    @ygshbht
    Contributor

    This fix, however, will highlight another issue: the inability to select the Left Hand Navigation (LHN) after the RHN is closed, due to an improperly positioned 'nodropzone' element. This will require a separate fix. The root cause of this issue should be investigated, and the position or behavior of the 'nodropzone' element should be adjusted accordingly to allow proper interaction with the LHN after the RHN is closed.
    #23885
    #23881

    The issue mentioned at the bottom might be fixed by this PR

  8. michaelhaxhiu commented on Aug 3, 2023

    @michaelhaxhiu
    Contributor

    Hm I can't reproduce this one on my android (pixel / android / google chrome / staging).

  9. michaelhaxhiu commented on Aug 3, 2023

    @michaelhaxhiu
    Contributor
    screen-20230803-134952.mp4

    Here's a recording. Am I missing a step here @dhanashree-sawant?

  10. added
    Needs Reproduction
    on Aug 3, 2023
  11. michaelhaxhiu commented on Aug 3, 2023

    @michaelhaxhiu
    Contributor

    I'm leaning toward closing this one as-is until we get more clarity around the steps to take.

  12. 22 remaining items

  13. melvin-bot commented on Aug 10, 2023

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  14. jliexpensify commented on Aug 11, 2023

    @jliexpensify
    Contributor

    Not overdue, waiting on proposals

  15. jliexpensify commented on Aug 15, 2023

    @jliexpensify
    Contributor

    No proposals yet, going to double this.

  16. changed the title [-][$1000] Back from user details opens group chat instead of group details on android chrome[/-] [+][$2000] Back from user details opens group chat instead of group details on android chrome[/+] on Aug 15, 2023
  17. melvin-bot commented on Aug 15, 2023

    @melvin-bot

    Upwork job price has been updated to $2000

  18. himanshuragi456 commented on Aug 15, 2023

    @himanshuragi456
    Contributor

    @jliexpensify I see no comments/reply is given to the current 2 proposals, are you sure those are not working/not acceptable?
    note: asking because I gave good efforts on an issue once but then an already existing proposal(that was posted before price doubling) was accepted.

  19. aimane-chnaif commented on Aug 15, 2023

    @aimane-chnaif
    Contributor

    I think this should have been discussed while navigation refactor.
    @mountiny can you please confirm that it's intentional to close all RHP modals (on mobile) when open DM chat by clicking "Message xxx" on profile page?

  20. aimane-chnaif commented on Aug 15, 2023

    @aimane-chnaif
    Contributor

    So the issue here is inconsistency - browser (or android device) back button goes to previous page (even RHP modal) correctly, while app back button goes to old screen skipping recent RHP modal pages.

  21. mountiny commented on Aug 15, 2023

    @mountiny
    Contributor

    @mountiny can you please confirm that it's intentional to close all RHP modals (on mobile) when open DM chat by clicking "Message xxx" on profile page?

    I think this is fine and intentional to make sure that the LHN is closer in the stack

    I am a little bit confused by this issue and honestly it feels so minor we could close this out. The mWeb / native discrepancies are hard

  22. jliexpensify commented on Aug 16, 2023

    @jliexpensify
    Contributor

    @himanshuragi456 Hi there - it's the C+ that will consider proposals, I'm just here to push the issue along and issue payments!

    Ok cool, going to close this one then - based of Vit's comment:

    I am a little bit confused by this issue and honestly it feels so minor we could close this out. The mWeb / native discrepancies are hard

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

Metadata

Metadata

Labels

BugDailyExternalHelp Wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions