Skip to content

[$500] Workspace - Incorrect primary login displayed after merge with other account #32127

Closed

Description

@kbecciv

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: 1.4.4.0
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:

Precondition: all accounts should be expensifail

  1. Log in as Account A and create a workspace
  2. Create a Workspace
  3. Invite other existing accounts B and C to the workspace
  4. Send some messages in the #Announce room and in the workspace chat for the 2 users you have access to
  5. Remove the account C from the workspace
  6. Navigate to OldDot and Log in with account B
  7. Merge the account B with the account C (that was just removed from the workspace)
  8. Navigate back to the new expensifail app and Log In with account B
  9. Tap on Search Icon and write the created workspace name in step 2 e.g. "Workspace 28"
  10. Tap on the archived workspace
  11. Repeat step 9-10

Expected Result:

Primary login should be displayed in header, search page and conversation

Actual Result:

Incorrect primary login displayed MERGED_0@applausetester+omd60@applause.expensifail.com

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

Bug6293275_1701181149677.RPReplay_Final1701180382.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0145c4b7f08b9c57c0
  • Upwork Job ID: 1729508760867057664
  • Last Price Increase: 2023-11-28
  • Automatic offers:
    • paultsimura | Contributor | 28016143

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 28, 2023
  2. melvin-bot commented on Nov 28, 2023

    @melvin-bot

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

  3. changed the title [-]Workspace - Incorrect primary login displayed after merge with other account[/-] [+][$500] Workspace - Incorrect primary login displayed after merge with other account[/+] on Nov 28, 2023
  4. melvin-bot commented on Nov 28, 2023

    @melvin-bot
  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Nov 28, 2023
  6. melvin-bot commented on Nov 28, 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
  7. melvin-bot commented on Nov 28, 2023

    @melvin-bot

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

  8. paultsimura commented on Nov 28, 2023

    @paultsimura
    Contributor

    Proposal

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

    After merging accounts, the login with "MERGED_0" prefix is displayed in multiple places.

    What is the root cause of that problem?

    This happens because after merging accounts, the other one's login gets a "MERGED_0" prefix prepended, and we do not handle this in a couple of places as we do here:

    let actorHint = (login || displayName || '').replace(CONST.REGEX.MERGED_ACCOUNT_PREFIX, '');

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

    We should update the corresponding places where we build users' display names to use .replace(CONST.REGEX.MERGED_ACCOUNT_PREFIX, ''):

    const longName = personalDetails.displayName ? personalDetails.displayName.replace(CONST.REGEX.MERGED_ACCOUNT_PREFIX, '') : formattedLogin;

    const longName = personalDetails.displayName ? personalDetails.displayName : formattedLogin;

    And also here:

    const displayName = lodashGet(passedPersonalDetails, pathToDisplayName, '').replace(CONST.REGEX.MERGED_ACCOUNT_PREFIX, '');

    /**
    * @param {Object | Null} passedPersonalDetails
    * @param {Array | String} pathToDisplayName
    * @param {String} [defaultValue] optional default display name value
    * @returns {String}
    */
    function getDisplayNameOrDefault(passedPersonalDetails, pathToDisplayName, defaultValue = '') {
    const displayName = lodashGet(passedPersonalDetails, pathToDisplayName);
    return displayName || defaultValue || Localize.translateLocal('common.hidden');
    }

    Optionally, if we want to keep the change in one place, we can just introduce it in PersonalDetailsUtils.getDisplayNameOrDefault and reuse it here:

    const longName = PersonalDetailsUtils.getDisplayNameOrDefault(personalDetails, 'displayName', formattedLogin);

    const longName = personalDetails.displayName ? personalDetails.displayName : formattedLogin;

    What alternative solutions did you explore? (Optional)

  9. allroundexperts commented on Dec 1, 2023

    @allroundexperts
    Contributor

    @paultsimura's proposal has the correct RCA and the solution looks good to me as well. Let's go with them!

    🎀 👀 🎀 C+ reviewed

  10. 28 remaining items

  11. conorpendergrast commented on Jan 16, 2024

    @conorpendergrast
    Contributor

    @paultsimura Thanks for flagging that! Moving to daily to pay today

  12. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Jan 16, 2024
  13. conorpendergrast commented on Jan 16, 2024

    @conorpendergrast
    Contributor

    Payouts:

    Upwork job is here.

  14. conorpendergrast commented on Jan 16, 2024

    @conorpendergrast
    Contributor

    Manually posting this as Melvin didn't do it:

    BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

    • [@allroundexperts] The PR that introduced the bug has been identified. Link to the PR:
    • [@allroundexperts] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
    • [@allroundexperts] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
    • [@allroundexperts] Determine if we should create a regression test for this bug.
    • [@allroundexperts] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
    • [@conorpendergrast] Link the GH issue for creating/updating the regression test once above steps have been agreed upon: https://github.com/Expensify/Expensify/issues/362457
  15. conorpendergrast commented on Jan 19, 2024

    @conorpendergrast
    Contributor

    @allroundexperts Bump on the C+ checklist please!

  16. allroundexperts commented on Jan 21, 2024

    @allroundexperts
    Contributor

    Checklist

    1. Check if policy room is archived because of merging #14779
    2. https://github.com/Expensify/App/pull/14779/files#r1461189881
    3. N/A
    4. A regression test would be helpful here. The test steps given in the OP look good to me and can be used to create the regression test.
  17. conorpendergrast commented on Jan 22, 2024

    @conorpendergrast
    Contributor

    Sounds good! QA test request created: https://github.com/Expensify/Expensify/issues/362457

    That's all folks, thanks!

  18. JmillsExpensify commented on Jan 30, 2024

    @JmillsExpensify
    Contributor

    $500 approved for @allroundexperts based on this comment.

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions