Skip to content

Concierge - Unable to navigate concierge chat via link with existing account #58059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 8 tasks
lanitochka17 opened this issue Mar 8, 2025 · 6 comments
Closed
1 of 8 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Mar 8, 2025

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.1.10-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5651249&group_by=cases:section_id&group_order=asc&group_id=229066
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause - Internal Team

Action Performed:

Preconditions: A personal account is created

  1. Go to https://staging.new.expensify.com/concierge
  2. Log in to NewDot with existing account

Expected Result:

User should be navigated to the concierge chat after login

Actual Result:

User is navigated to the random chat

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
Bug6763073_1741278517946.bandicam_2025-03-06_17-45-24-388.mp4

View all open jobs on GitHub

@lanitochka17 lanitochka17 added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Mar 8, 2025
Copy link

melvin-bot bot commented Mar 8, 2025

Triggered auto assignment to @sakluger (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.

@Themoonalsofall
Copy link
Contributor

Themoonalsofall commented Mar 9, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-03-09 10:05:09 UTC.

Proposal

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

Concierge - Unable to navigate concierge chat via link with existing account

What is the root cause of that problem?

Because before logging in we cannot know the concierge's reportID so the reportID here will be undefined

const reportID = getReportIDFromLink(url);

After we login we will navigate to lastAccessedReportRoute

App/src/libs/actions/Report.ts

Lines 2962 to 2966 in 6cb1f44

if (lastAccessedReportID) {
const lastAccessedReportRoute = ROUTES.REPORT_WITH_ID.getRoute(lastAccessedReportID);
Navigation.navigate(lastAccessedReportRoute);
return;
}

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

we should add a condition before that if the route is concierge then we will navigate to Concierge page

        if(route === CONST.CONCIERGE_CHAT_NAME.toLowerCase()){
            navigateToConciergeChat(false, () => true);
            return;
        }

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

we need to add test to function openReportFromDeepLink if the url is ROUTES.CONCIERGE then it is expected that we navigate to the concierge page

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.

@truph01
Copy link
Contributor

truph01 commented Mar 9, 2025

Proposal

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

  • User is navigated to the random chat

What is the root cause of that problem?

  • When a user deep-links to /concierge and then logs in, there is logic in place to navigate them to the appropriate report:

    App/src/libs/actions/Report.ts

    Lines 2958 to 2976 in 6cb1f44

    const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
    // If the report does not exist, navigate to the last accessed report or Concierge chat
    if (!report) {
    const lastAccessedReportID = findLastAccessedReport(false, shouldOpenOnAdminRoom(), undefined, reportID)?.reportID;
    if (lastAccessedReportID) {
    const lastAccessedReportRoute = ROUTES.REPORT_WITH_ID.getRoute(lastAccessedReportID);
    Navigation.navigate(lastAccessedReportRoute);
    return;
    }
    navigateToConciergeChat(false, () => true);
    return;
    }
    Navigation.navigate(route as Route);
    };
    if (isAnonymousUser()) {
    handleDeeplinkNavigation();
    return;

  • As seen in the code, when the route is concierge, reportID is undefined, which results in report also being undefined. Consequently, the user is navigated to the last accessed report. In other words, they may end up in a random chat, as described in the OP.

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

  • We should navigated user to ConciergePage screen directly. In this screen, we already had a logic to navigated user to correct concierge screen. To do it, we can add:
if (route === ROUTES.CONCIERGE) {
                    Navigation.navigate(route as Route);
                    return;
                }

in here.

  • Note: When a user deep-links to the concierge route, they should first be navigated to the ConciergePage. From there, the app should navigate them to the appropriate concierge report. This requirement was mentioned here. That is why I suggested using Navigation.navigate(route as Route) instead of navigateToConciergeChat(false, () => true). However, navigateToConciergeChat(false, () => true) is also a viable option to consider.

  • Optional: After testing, I noticed that an anonymous user attempting to access the concierge route encounters an error. To prevent this, we should restrict anonymous users from accessing the concierge route by removing concierge from:

    const routesAccessibleByAnonymousUser = [ROUTES.SIGN_IN_MODAL, ROUTES.REPORT_WITH_ID_DETAILS.route, ROUTES.REPORT_WITH_ID_DETAILS_SHARE_CODE.route, ROUTES.CONCIERGE];

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

  • We should test the openReportFromDeepLink function with concierge as the URL parameter. The test should ensure that the user is ultimately navigated to the concierge route (ConciergePage).

What alternative solutions did you explore? (Optional)

@jaydamani
Copy link
Contributor

Proposal

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

Unable to navigate concierge chat via link with existing account

What is the root cause of that problem?

The redirection after we sign in is handled openReportFromDeepLink

App/src/libs/actions/Report.ts

Lines 2956 to 2971 in 6cb1f44

// Check if the report exists in the collection
const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
// If the report does not exist, navigate to the last accessed report or Concierge chat
if (!report) {
const lastAccessedReportID = findLastAccessedReport(false, shouldOpenOnAdminRoom(), undefined, reportID)?.reportID;
if (lastAccessedReportID) {
const lastAccessedReportRoute = ROUTES.REPORT_WITH_ID.getRoute(lastAccessedReportID);
Navigation.navigate(lastAccessedReportRoute);
return;
}
navigateToConciergeChat(false, () => true);
return;
}
Navigation.navigate(route as Route);

In this code, report id is taken from the url before sign-in and if the user does not have access to the report, they are redirected to the last report they visited.
But when the url before sign in is not for a report (in our case it is /conceirge) it will still attempt to get a report with report id as blank or undefined and will redirect the user to the last accessed page as there is no such report

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

Redirect to the last report only when the url before sign in was a report url and the user does not have access to that report.

To do this, update below condition to check for report id as well

if (!report) {

Updated:

    if (reportID && !report)

The above solution assumes that if the user visits any route like /settings without authentication then they should be redirected to that page after signing in. If we only want the redirection for specific routes like conceirge we can also add condition to return if the route befoere sign in is either a report with id or conceirge

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

Test /conceirge is redirected to the conceirge chat after sing in

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.

@samranahm
Copy link
Contributor

Dupe of #56692

@VictoriaExpensify
Copy link
Contributor

I think we should close this out and handle it in the oldest issue - #56692.

@jaydamani @truph01 @Themoonalsofall feel free to add you proposals to that issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2
Projects
None yet
Development

No branches or pull requests

7 participants