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

[HOLD for payment 2024-09-16][$250] mWeb - Chat - In contacts a random guest user is displayed after login via public room link #47806

Closed
1 of 6 tasks
lanitochka17 opened this issue Aug 21, 2024 · 25 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause Reviewing Has a PR in review Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Aug 21, 2024

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.0.22
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to this link as signed out user https://staging.new.expensify.com/r/7075912447943023
  2. Tap sign in
  3. Enter credentials and log in
  4. Navigate to LHN
  5. Tap fab -- start chat
  6. In contacts, note a guest user is added.

Expected Result:

In contacts, a random guest user must not be displayed after login via public room link

Actual Result:

In contacts, a random guest user is displayed after login via public room link

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

Bug6578301_1724253847611.screenrecorder-2024-08-21-15-17-35-544_compress_1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0148f0358fba85f9ac
  • Upwork Job ID: 1828135607297326184
  • Last Price Increase: 2024-08-26
  • Automatic offers:
    • jjcoffee | Reviewer | 103703199
    • dominictb | Contributor | 103703202
Issue OwnerCurrent Issue Owner: @jjcoffee
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 21, 2024
Copy link

melvin-bot bot commented Aug 21, 2024

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

@lanitochka17
Copy link
Author

@CortneyOfstad FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@dominictb
Copy link
Contributor

dominictb commented Aug 21, 2024

Edited by proposal-police: This proposal was edited at 2023-10-07T14:32:22Z.

Proposal

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

In contacts, a random guest user is displayed after login via public room link

What is the root cause of that problem?

When opening a public room as an anonymous user, the session data is:

accountID: A,
email: [email protected]

and we create a personal detail for it:

accountID: A,
displayName: "Guest",
lastName: "Guest"

and after signing, we do not clear these data, so these data appear in contact list.

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

  • We should create a function to cleanup the anon personal detail:
function removeAnonFromPersonalDetails() {
    const anonAccountIDs = Object.values(personalDetails).filter((detail) => detail?.login?.includes('@expensify.anon'));
    const data = anonAccountIDs.reduce((res, detail) => ({...res, [detail.accountID]: null}), {});
    Onyx.merge(ONYXKEYS.PERSONAL_DETAILS_LIST, data);
}

and call it in:

// This means sign in in RHP was successful, so we can subscribe to user events

What alternative solutions did you explore? (Optional)

  • Solution 1:

Can use useEffect:

    const isAnonymousUser = session?.authTokenType === CONST.AUTH_TOKEN_TYPES.ANONYMOUS;
    const prevIsAnonymousUser = usePrevious(isAnonymousUser);
    useEffect(() => {
        if (prevIsAnonymousUser && !isAnonymousUser) {
            removeAnonFromPersonalDetails();
        }
    }, [prevIsAnonymousUser, isAnonymousUser]);
  • Solution 2:

Can cleanup the anon personal details when the sign in API is called successfully, such as in:

const successData: OnyxUpdate[] = [

and
const successData: OnyxUpdate[] = [

@dominictb
Copy link
Contributor

Proposal Updated

@CortneyOfstad
Copy link
Contributor

I am confused by the steps, as it specifically mentions In contacts, note a guest user is added.

The contact was not added to the chat, but rather a suggestion. And this is by design.

@lanitochka17 does the tester recognize that email in any capacity in regards to Expensify or testing within Expensify?

@dominictb
Copy link
Contributor

@CortneyOfstad
If we do not sign in and then visit the public room, a random personal detail data is assigned to us. That data is something like:

accountID: A,
displayName: "Guest",
lastName: "Guest",
login: [email protected],

Then when signing in, the above random user data is not cleared, so it is displayed in the contact list.

@melvin-bot melvin-bot bot added the Overdue label Aug 26, 2024
@CortneyOfstad
Copy link
Contributor

Thank you @dominictb for the clarification!

I am having trouble recreating this, so I am going to have this retest by QA 👍

@melvin-bot melvin-bot bot removed the Overdue label Aug 26, 2024
@CortneyOfstad CortneyOfstad added External Added to denote the issue can be worked on by a contributor Overdue retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause labels Aug 26, 2024
@melvin-bot melvin-bot bot changed the title mWeb - Chat - In contacts a random guest user is displayed after login via public room link [$250] mWeb - Chat - In contacts a random guest user is displayed after login via public room link Aug 26, 2024
Copy link

melvin-bot bot commented Aug 26, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0148f0358fba85f9ac

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 26, 2024
Copy link

melvin-bot bot commented Aug 26, 2024

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

Copy link

melvin-bot bot commented Aug 26, 2024

@CortneyOfstad Whoops! This issue is 2 days overdue. Let's get this updated quick!

@jjcoffee
Copy link
Contributor

@dominictb's proposal LGTM! I think cleaning up on the API success callback seems the neatest way to do this as we can then pass the accountID to clear from the session data. Happy to listen to arguments otherwise if I've missed anything!

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Aug 27, 2024

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

@dangrous
Copy link
Contributor

Yeah updating it in the success data makes sense to me, then we already know which account ID to remove.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 27, 2024
Copy link

melvin-bot bot commented Aug 27, 2024

📣 @jjcoffee 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Aug 27, 2024

📣 @dominictb 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Aug 28, 2024
@CortneyOfstad
Copy link
Contributor

PR is still being reviewed!

@bfitzexpensify
Copy link
Contributor

@dominictb @jjcoffee can you please take a look at #48715 to see if it is related to your changes? It was found while executing #48144

@mvtglobally
Copy link

Issue not reproducible during KI retests. (First week)

@VictoriaExpensify
Copy link
Contributor

Bumping Ben's message above - @jjcoffee I think you were looking into this:

@dominictb @jjcoffee can you please take a look at #48715 to see if it is related to your changes? It was found while executing #48144

It looks like these are probably related issues

@jjcoffee
Copy link
Contributor

jjcoffee commented Sep 9, 2024

I can't repro after reverting the changes from the PR, so I don't think it's related.

@dominictb
Copy link
Contributor

dominictb commented Sep 9, 2024

I can reproduce that bug in prod, so I think it is not related to PR, because it is not deployed to prod.

cc @bfitzexpensify

@jjcoffee
Copy link
Contributor

Looks like the automation failed again! This hit production 2024-09-09, so this should be held for payment 2024-09-16. cc @CortneyOfstad

@dangrous dangrous changed the title [$250] mWeb - Chat - In contacts a random guest user is displayed after login via public room link [HOLD for payment 2024-09-16][$250] mWeb - Chat - In contacts a random guest user is displayed after login via public room link Sep 11, 2024
@CortneyOfstad
Copy link
Contributor

Thanks @jjcoffee!

@mvtglobally
Copy link

Issue not reproducible during KI retests. (Second week)

@CortneyOfstad
Copy link
Contributor

Payment Summary

@jjcoffee — paid $250 via Upwork
@dominictb — paid $250 via Upwork

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. External Added to denote the issue can be worked on by a contributor retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

8 participants