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 2023-09-20] [$1000] Workspace - Incorrect Behavior When Inviting Existing User with Capitalized Email #25636

Closed
2 of 6 tasks
lanitochka17 opened this issue Aug 22, 2023 · 38 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Aug 22, 2023

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
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 22, 2023
@DylanDylann
Copy link
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

@esh-g
Copy link
Contributor

esh-g commented Aug 22, 2023

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

@c3024
Copy link
Contributor

c3024 commented Aug 22, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 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 Overdue label Aug 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 25, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2023

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

@muttmuure muttmuure added the External Added to denote the issue can be worked on by a contributor label Aug 29, 2023
@melvin-bot melvin-bot bot changed the title Workspace - Incorrect Behavior When Inviting Existing User with Capitalized Email [$1000] Workspace - Incorrect Behavior When Inviting Existing User with Capitalized Email Aug 29, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2023

Job added to Upwork: https://www.upwork.com/jobs/~010c78f3bb410f312f

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

melvin-bot bot commented Aug 29, 2023

Current assignee @muttmuure is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2023

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

@muttmuure
Copy link
Contributor

Added external

@melvin-bot melvin-bot bot removed the Overdue label Aug 29, 2023
@jjcoffee
Copy link
Contributor

So we've got three duplicate proposals here, all with the correct RCA and solution. @DylanDylann's proposal happens to be the first so we can go with that!

🎀👀🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2023

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

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

melvin-bot bot commented Aug 30, 2023

📣 @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

@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2023

📣 @DylanDylann You have been assigned to this job!
Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2023

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

Offer link
Upwork job

@jjcoffee
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: fix: header message for already invited member of workspace #23490
  • 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: fix: header message for already invited member of workspace #23490 (comment)
  • 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: N/A - checklist item already exists to ensure test steps cover all possible scenarios
  • Determine if we should create a regression test for this bug. No - fairly edge case and so not high value enough
  • 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. N/A

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Sep 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 22, 2023

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

@jjcoffee
Copy link
Contributor

@muttmuure Gentle bump for payment here. Also, I think this may be due the timeliness bonus as it was only delayed due to the merge freeze (see this comment).

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Sep 25, 2023
@techievivek
Copy link
Contributor

Gentle bump @muttmuure ^

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Sep 29, 2023
@techievivek
Copy link
Contributor

Gentle bump @muttmuure ^^

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Oct 2, 2023
@muttmuure
Copy link
Contributor

Getting to this now

@melvin-bot melvin-bot bot removed the Overdue label Oct 4, 2023
@muttmuure
Copy link
Contributor

Offers sent, including urgency bonus

@jjcoffee
Copy link
Contributor

jjcoffee commented Oct 4, 2023

@muttmuure Thanks, offer accepted!

@Habben101
Copy link

@muttmuure Thanks, I've accepted the offer.

@melvin-bot melvin-bot bot added the Overdue label Oct 9, 2023
@techievivek
Copy link
Contributor

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

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Oct 9, 2023
@techievivek
Copy link
Contributor

DMed Matt to look into it.

@melvin-bot melvin-bot bot removed the Overdue label Oct 11, 2023
@muttmuure
Copy link
Contributor

Handling

@muttmuure
Copy link
Contributor

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

@DylanDylann
Copy link
Contributor

@muttmuure I've accepted, thank you!

@muttmuure
Copy link
Contributor

Paid!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants