Skip to content
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

[$500] Deeplinks - Previous chat opens when click on chat deeplink and sign out & sign in to app #31150

Closed
2 of 6 tasks
lanitochka17 opened this issue Nov 9, 2023 · 41 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Nov 9, 2023

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: 1.3.97-2
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. Open app
  2. Navigate to any conversation
  3. Send the deeplink message "https://staging.new.expensify.com/concierge"
    to the conversation
  4. Click on the deeplink in the conversation
  5. Clcik on Profile icon in LHN
  6. Click on Sign Out
  7. Sign In with the same account

Expected Result:

The last opened conversation within deeplink should be displayed when Sign In with the same account

Actual Result:

The previous opened conversation displays

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

Bug6270280_1699552025862.Screen_Recording_2023-11-09_at_18.21.36.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0114ab65213ca44cff
  • Upwork Job ID: 1722677810558033920
  • Last Price Increase: 2023-11-30
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 9, 2023
@melvin-bot melvin-bot bot changed the title Deeplinks - Previous chat opens when click on chat deeplink and sign out & sign in to app [$500] Deeplinks - Previous chat opens when click on chat deeplink and sign out & sign in to app Nov 9, 2023
Copy link

melvin-bot bot commented Nov 9, 2023

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

Copy link

melvin-bot bot commented Nov 9, 2023

Job added to Upwork: https://www.upwork.com/jobs/~0114ab65213ca44cff

Copy link

melvin-bot bot commented Nov 9, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 9, 2023
Copy link

melvin-bot bot commented Nov 9, 2023

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

@DylanDylann
Copy link
Contributor

DylanDylann commented Nov 9, 2023

Maybe same RCA with #30868

Copy link

melvin-bot bot commented Nov 13, 2023

@eVoloshchak, @jliexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

1 similar comment
Copy link

melvin-bot bot commented Nov 13, 2023

@eVoloshchak, @jliexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@jliexpensify
Copy link
Contributor

@eVoloshchak should we pop this on hold as per this comment?

@melvin-bot melvin-bot bot removed the Overdue label Nov 14, 2023
Copy link

melvin-bot bot commented Nov 16, 2023

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

@melvin-bot melvin-bot bot added the Overdue label Nov 16, 2023
@jliexpensify
Copy link
Contributor

Bump @eVoloshchak

@melvin-bot melvin-bot bot removed the Overdue label Nov 17, 2023
@jliexpensify
Copy link
Contributor

Bumped @eVoloshchak on Slack to confirm this

@eVoloshchak
Copy link
Contributor

Tested @DylanDylann's draft PR for #30868, but our issue still persists

The "Clicking on a deeplink" part isn't relevant to the issue, you can still reproduce it by simply signing Out and then back In, so the issues are similar (but aren't resolved by the same fix)

@DylanDylann
Copy link
Contributor

DylanDylann commented Nov 21, 2023

Proposal

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

  • Deeplinks - Previous chat opens when click on chat deeplink and sign out & sign in to app

What is the root cause of that problem?

  • When launching the app with the deeplink that does not contain reportID, we use the getLastAccessedReportID to get the report to display.

    const getLastAccessedReportID = (reports, ignoreDefaultRooms, policies, isFirstTimeNewExpensifyUser, openOnAdminRoom) => {
    // If deeplink url contains reportID params, we should show the report that has this reportID.
    const currentRoute = Navigation.getActiveRoute();
    const {reportID} = ReportUtils.parseReportRouteParams(currentRoute);
    if (reportID) {
    return reportID;
    }
    const lastReport = ReportUtils.findLastAccessedReport(reports, ignoreDefaultRooms, policies, isFirstTimeNewExpensifyUser, openOnAdminRoom);
    return lodashGet(lastReport, 'reportID');
    };

  • In the above, the findLastAccessedReport is not working properly.

    App/src/libs/ReportUtils.js

    Lines 575 to 581 in 7bd51eb

    function findLastAccessedReport(reports, ignoreDomainRooms, policies, isFirstTimeNewExpensifyUser, openOnAdminRoom = false) {
    // If it's the user's first time using New Expensify, then they could either have:
    // - just a Concierge report, if so we'll return that
    // - their Concierge report, and a separate report that must have deeplinked them to the app before they created their account.
    // If it's the latter, we'll use the deeplinked report over the Concierge report,
    // since the Concierge report would be incorrectly selected over the deep-linked report in the logic below.
    let sortedReports = sortReportsByLastRead(reports);

  • findLastAccessedReport uses sortReportsByLastRead:

    App/src/libs/ReportUtils.js

    Lines 263 to 269 in 7bd51eb

    function sortReportsByLastRead(reports) {
    return _.chain(reports)
    .toArray()
    .filter((report) => report && report.reportID && report.lastReadTime)
    .sortBy('lastReadTime')
    .value();
    }
    that will sort the reports by "lastReadTime". This is incorrect because the "lastReadTime" refers to the latest time the user read a new message, not the latest time the user visits a report. For example, if we read a new message A on 3/10/2023, and re-visit its report on 4/10/2023, the "lastReadTime" is still '3/10/2023'.

  • Note: The soluttion in 30868 cannot fix this issue because the lastAccessedTime is cleared after signout

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

  • We can create the ONYXKEYS.LAST_ACCESSED_REPORT_ID_BEFORE_SIGNOUT to store the reportID that user opened before signout
  • Then, once we signout, set the ONYXKEYS.LAST_ACCESSED_REPORT_ID_BEFORE_LOGOUT to the current reportID
  • Then, update:
    const getLastAccessedReportID = (reports, ignoreDefaultRooms, policies, isFirstTimeNewExpensifyUser, openOnAdminRoom) => {

    to:
const getLastAccessedReportID = (reports, ignoreDefaultRooms, policies, isFirstTimeNewExpensifyUser, openOnAdminRoom, reportIDBeforeLogout) => {
    if (reportIDBeforeLogout) {
        Onyx.merge(ONYXKEYS.REPORT_ID_BEFORE_LOGOUT, null);
        return reportIDBeforeLogout;
    }
...

What alternative solutions did you explore? (Optional)

  • Also, in 30868 `s solution, we are creating the lastVisitedTime in report, which will be cleared when the user signs out. So rather than that way, we can create a new collection, ONYXKEYS.LAST_VISIT_TIME to store the lastVisitTime each reportID, that is not cleared when the user signs out

@DylanDylann
Copy link
Contributor

@eVoloshchak just updated my proposal in What alternative solutions did you explore? (Optional), please help check

Copy link

melvin-bot bot commented Nov 23, 2023

@eVoloshchak @jliexpensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

Copy link

melvin-bot bot commented Nov 23, 2023

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

@melvin-bot melvin-bot bot added the Overdue label Nov 24, 2023
@eVoloshchak
Copy link
Contributor

@DylanDylann, since we only store lastVisitedTime locally, this would still work incorrectly across devices

  1. Navigate to any conversation on device A
  2. Send the deeplink message "https://staging.new.expensify.com/concierge"
  3. to the conversation
  4. Click on the deeplink in the conversation
  5. Open the app on device B
  6. Notice another conversation is displayed

Can we store lastVisitedTime on the back end so we show the correct report on startup across devices/apps?

Copy link

melvin-bot bot commented Dec 7, 2023

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

@jliexpensify
Copy link
Contributor

Hi @aimane-chnaif - hoping you can help us with this issue? Haven't heard from Eugene in a while so re-assigning.

Thanks!

@aimane-chnaif
Copy link
Contributor

aimane-chnaif commented Dec 8, 2023

I'd like to confirm with engineer if last opened report should open upon login across devices
🎀 👀 🎀

Copy link

melvin-bot bot commented Dec 8, 2023

Triggered auto assignment to @aldo-expensify, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot added the Overdue label Dec 11, 2023
Copy link

melvin-bot bot commented Dec 12, 2023

@jliexpensify, @aldo-expensify, @aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick!

@aldo-expensify
Copy link
Contributor

I'd like to confirm with engineer if last opened report should open upon login across devices

I'm not really sure, I think its better to ask this in #epensify-open-source

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Dec 12, 2023
@aldo-expensify
Copy link
Contributor

@melvin-bot melvin-bot bot removed the Overdue label Dec 15, 2023
@jliexpensify
Copy link
Contributor

Thanks @aldo-expensify , have re-bumped so it doesn't get lost.

@aldo-expensify
Copy link
Contributor

aldo-expensify commented Dec 18, 2023

Considering this, should we hold on #31424 / #30868 ?

@jliexpensify jliexpensify added Weekly KSv2 and removed Daily KSv2 labels Dec 19, 2023
@jliexpensify jliexpensify changed the title [$500] Deeplinks - Previous chat opens when click on chat deeplink and sign out & sign in to app [HOLD ON #31424 / #30868][$500] Deeplinks - Previous chat opens when click on chat deeplink and sign out & sign in to app Dec 19, 2023
@melvin-bot melvin-bot bot added the Overdue label Dec 27, 2023
@jliexpensify
Copy link
Contributor

Still on hold

@melvin-bot melvin-bot bot removed the Overdue label Dec 28, 2023
@melvin-bot melvin-bot bot added the Overdue label Jan 5, 2024
@aldo-expensify
Copy link
Contributor

#31424 reached production. I think it is time to UNHOLD and reevaluate what we have to do here.

@melvin-bot melvin-bot bot removed the Overdue label Jan 8, 2024
@aldo-expensify aldo-expensify changed the title [HOLD ON #31424 / #30868][$500] Deeplinks - Previous chat opens when click on chat deeplink and sign out & sign in to app [$500] Deeplinks - Previous chat opens when click on chat deeplink and sign out & sign in to app Jan 8, 2024
@aldo-expensify
Copy link
Contributor

@lanitochka17 can you retest this and confirm if this is still an issue? 🙏

@lanitochka17
Copy link
Author

lanitochka17 commented Jan 8, 2024

@aldo-expensify Hello
The issue is not reproducible on the latest build 1.4.22-4

Screen.Recording.2024-01-08.at.20.44.36.mp4

@aldo-expensify
Copy link
Contributor

Thanks @lanitochka17 !

I'll close this then. Feel free to reopen if someone manages to reproduce.

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. Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Weekly KSv2
Projects
None yet
Development

No branches or pull requests

6 participants