Skip to content

[HOLD for payment 2023-09-20] [$1000] Workspace - Incorrect Behavior When Inviting Existing User with Capitalized Email #25636

Closed

Description

@lanitochka17

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. Navigate to any workspace
  2. Open the "Members" page within the workspace
  3. Click the "Invite" button and invite a new user
  4. Go back to the "Members" page
  5. Attempt to invite the same user again, but this time, capitalize the first letter of the user's email address or write the email address entirely in capital letters
  6. Observe the description that is displayed

Expected Result:

The description should clearly state that the user is already a member of the workspace

Actual Result:

Instead of the expected message, it displays "No results found" when inviting the same user with capitalized email letters

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • Windows / Chrome
  • MacOS / Desktop

Version Number: 1.3.56-0

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

CapitalizedInvitation.mp4
Recording.2949.mp4

Expensify/Expensify Issue URL:

Issue reported by: @Habben101

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1691797768663379

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~010c78f3bb410f312f
  • Upwork Job ID: 1696552547259813888
  • Last Price Increase: 2023-08-29
  • Automatic offers:
    • jjcoffee | Reviewer | 26416348
    • Habben101 | Reporter | 26416352

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 22, 2023
  2. DylanDylann commented on Aug 22, 2023

    @DylanDylann
    Contributor

    Proposal

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

    Incorrect Behavior When Inviting Existing User with Capitalized Email

    What is the root cause of that problem?

    const headerMessage = useMemo(() => {
    const searchValue = searchTerm.trim();
    if (!userToInvite && CONST.EXPENSIFY_EMAILS.includes(searchValue)) {
    return translate('messages.errorMessageInvalidEmail');
    }
    if (!userToInvite && excludedUsers.includes(searchValue)) {
    return translate('messages.userIsAlreadyMemberOfWorkspace', {login: searchValue, workspace: policyName});
    }
    return OptionsListUtils.getHeaderMessage(personalDetails.length !== 0, Boolean(userToInvite), searchValue);
    }, [excludedUsers, translate, searchTerm, policyName, userToInvite, personalDetails]);

    We don't lowercase the search value before validating it

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

    we should lowercase searchvalue before validating like this

    const searchValue = searchTerm.trim().toLowerCase();
    

    Result

    Screenshot 2023-08-18 at 14 50 59
  3. esh-g commented on Aug 22, 2023

    @esh-g
    Contributor

    Proposal

    Please re-state the problem

    There is a difference of error messages between uppercase and lowercase emails.

    What is the root cause of this problem?

    We are not converting the searchTerm to lowercase while comparing it to the excluded participants.

    const searchValue = searchTerm.trim();

    What changes should be made in order to solve this problem?

    We should convert the searchTerm to lowercase before comparing which can be done like this:

    const searchValue = searchTerm.trim().toLowerCase();

    This is approach is being used in other places as well, so I think we will be consistent in that approach.

    const searchValue = parsedPhoneNumber.possible ? parsedPhoneNumber.number.e164 : searchInputValue.toLowerCase();

    const normalizedSearchTerm = searchTerm.toLowerCase().trim().replaceAll(':', '');

    What other alternative approach did you explore? (Optional)

    None

  4. c3024 commented on Aug 22, 2023

    @c3024
    Contributor

    Proposal

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

    Emails of workspace members when typed in capital letters in the Invite search input shows 'No results found' instead of showing "user already a member of the workspace"

    What is the root cause of that problem?

    We are directly matching the trimmed searchTerm without converting it to lower case.

    const headerMessage = useMemo(() => {
    const searchValue = searchTerm.trim();
    if (!userToInvite && CONST.EXPENSIFY_EMAILS.includes(searchValue)) {
    return translate('messages.errorMessageInvalidEmail');
    }
    if (!userToInvite && excludedUsers.includes(searchValue)) {
    return translate('messages.userIsAlreadyMemberOfWorkspace', {login: searchValue, workspace: policyName});

    So already existing emails do not get matched because they are in lower case and the search string includes capital letters.

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

    We should change this mentioned above

    const searchValue = searchTerm.trim();

    to

    const searchValue = searchTerm.trim().toLowerCase();

    Now even Expensify emails are matched case-insensitively.

    What alternative solutions did you explore? (Optional)

    We can instead not convert directly the searchValue to lower case and change it to lower case in the conditionals like this

    const searchValue = searchTerm.trim();
    if (!userToInvite && CONST.EXPENSIFY_EMAILS.includes(searchValue.toLowerCase())) {
        return translate('messages.errorMessageInvalidEmail');
    }
    if (!userToInvite && excludedUsers.includes(searchValue.toLowerCase())) {
        return translate('messages.userIsAlreadyMemberOfWorkspace', {login: searchValue, workspace: policyName});
    }

    Slight difference with this is the header message is shown in the same case as the search value with this solution whereas with the first solution the header message shows the lower case email.

    Result
    capitalLetterEmailSearchInWorkspaceInvitePage.mov
    capitalLetterEmailSearchInWorkspaceInvitePage2.mov
  5. melvin-bot commented on Aug 22, 2023

    @melvin-bot

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

  6. melvin-bot commented on Aug 22, 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 Aug 25, 2023

    @melvin-bot

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

  8. melvin-bot commented on Aug 29, 2023

    @melvin-bot

    @muttmuure Still overdue 6 days?! Let's take care of this!

  9. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Aug 29, 2023
  10. changed the title [-]Workspace - Incorrect Behavior When Inviting Existing User with Capitalized Email[/-] [+][$1000] Workspace - Incorrect Behavior When Inviting Existing User with Capitalized Email[/+] on Aug 29, 2023
  11. melvin-bot commented on Aug 29, 2023

    @melvin-bot
  12. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Aug 29, 2023
  13. 43 remaining items

  14. muttmuure commented on Oct 4, 2023

    @muttmuure
    Contributor

    Offers sent, including urgency bonus

  15. jjcoffee commented on Oct 4, 2023

    @jjcoffee
    Contributor

    @muttmuure Thanks, offer accepted!

  16. Habben101 commented on Oct 4, 2023

    @Habben101

    @muttmuure Thanks, I've accepted the offer.

  17. techievivek commented on Oct 9, 2023

    @techievivek
    Contributor

    @muttmuure are we done with the payment here? Can we close the issue now?

  18. techievivek commented on Oct 11, 2023

    @techievivek
    Contributor

    DMed Matt to look into it.

  19. muttmuure commented on Oct 11, 2023

    @muttmuure
    Contributor

    Handling

  20. muttmuure commented on Oct 11, 2023

    @muttmuure
    Contributor

    Just waiting on @DylanDylann to accept, then we can close out

  21. DylanDylann commented on Oct 11, 2023

    @DylanDylann
    Contributor

    @muttmuure I've accepted, thank you!

  22. muttmuure commented on Oct 11, 2023

    @muttmuure
    Contributor

    Paid!

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