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] Room - Can invite valid phone account multiple times into the room #30190

Closed
6 tasks done
kbecciv opened this issue Oct 23, 2023 · 51 comments
Closed
6 tasks done
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 Weekly KSv2

Comments

@kbecciv
Copy link

kbecciv commented Oct 23, 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.89.6
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: @namhihi237
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1698051749271339

Action Performed:

  1. Create a WS
  2. Create a room with workspace
  3. Click room header => Members => Invite
  4. Input an invalid phone (eg: +3233232432) then select and click invite
  5. Repeat step 4

Expected Result:

The app should show an error when inviting an invalid phone number

Actual Result:

The system does not show errors and may invite invalid phone numbers multiple times

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

Android: Native
Screen.Recording.2023-10-23.at.19.42.26.mov
Android: mWeb Chrome
Screen.Recording.2023-10-23.at.19.42.26.mov
iOS: Native
Screen.Recording.2023-10-23.at.19.42.26.1.mov
iOS: mWeb Safari
Screen.Recording.2023-10-23.at.19.43.59.mov
MacOS: Chrome / Safari
Screen.Recording.2023-10-23.at.16.06.33.mov
Recording.5119.mp4
MacOS: Desktop
Screen.Recording.2023-10-23.at.19.36.43.mov

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01da7f12cf9ed3d23f
  • Upwork Job ID: 1716509714359189504
  • Last Price Increase: 2023-10-30
  • Automatic offers:
    • DylanDylann | Contributor | 27539247
    • namhihi237 | Reporter | 27539248
@kbecciv kbecciv 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 Oct 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

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

@melvin-bot melvin-bot bot changed the title Room - Can invite invalid phone account multiple times into the room [$500] Room - Can invite invalid phone account multiple times into the room Oct 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01da7f12cf9ed3d23f

@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 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 Oct 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

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

@alitoshmatov
Copy link
Contributor

I think number provided number(+3233232432) is valid number

@namhihi237
Copy link
Contributor

@alitoshmatov you can try with a new chat. the backend return invalid

@namhihi237
Copy link
Contributor

I think issue should fixed in backend.

@FitseTLT
Copy link
Contributor

FitseTLT commented Oct 23, 2023

Proposal

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

Room allows multiple invitation for phone number which is already a member.

What is the root cause of that problem?

The problem is not invalid phone numbers can be invited multiple times (as commented in the title of the issue). It correctly validates when you input wrong number but for valid phone numbers it let's you invite it multiple times without validating and informing the user that the phone number is already a member of the room as it correctly does for emails.
This is because of a bug which lies in this line of code

!_.find(optionsToExclude, (optionToExclude) => optionToExclude.login === addSMSDomainIfPhoneNumber(searchValue).toLowerCase()) &&
(searchValue !== CONST.EMAIL.CHRONOS || Permissions.canUseChronos(betas)) &&

Because it is comparing existing login list of members of the room (optionsToExclude) with the phone number input (searchInput) of the user passed to the addSMSDomainIfPhoneNumber function which concatinates '@expensify.sms' to the searchInput. But as I observed the login value for the phone number only holds the phone number without '@expensify.sms' concatination. Hence, existing phone numbers will never be filtered out as the comparison will always be false.

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

Change

!_.find(optionsToExclude, (optionToExclude) => optionToExclude.login === addSMSDomainIfPhoneNumber(searchValue).toLowerCase()) &&
(searchValue !== CONST.EMAIL.CHRONOS || Permissions.canUseChronos(betas)) &&

to

        !_.find(optionsToExclude, (optionToExclude) => optionToExclude.login === searchValue.toLowerCase()) &&

Result:

10.New.Expensify.mp4

What alternative solutions did you explore? (Optional)

May be if this code is also necessary to support for previous login info (if there was time where we used to save phone number concatinated with '@expensify.sms' ) we could add an or condition to support for both situations like

!_.find(optionsToExclude, (optionToExclude) => optionToExclude.login === searchValue.toLowerCase() || optionToExclude.login === addSMSDomainIfPhoneNumber(searchValue).toLowerCase()) &&

@melvin-bot melvin-bot bot added the Overdue label Oct 26, 2023
@FitseTLT
Copy link
Contributor

Updated comment And I think this bug is worthy of fixing.

@DylanDylann
Copy link
Contributor

DylanDylann commented Oct 26, 2023

Proposal

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

  • Room - Can invite invalid phone account multiple times into the room

What is the root cause of that problem?

  • From my side, the +3233232432 is a valid phone number, so we need to update the issue `s title.
  • When we select the phone number A (for example A is +3233232432), we send it to BE without adding sms domain (@expensify.sms). Then BE will merge phone number A to report.participants without sms domain as well. Now the report.participants is [..., A].
  • Then we search A again, because the excludeUser is get from report.participants, so now the excludeUser is [..., A] as well.
  • In getOptions function, the below logic:
    !_.find(optionsToExclude, (optionToExclude) => optionToExclude.login === addSMSDomainIfPhoneNumber(searchValue).toLowerCase()) &&

    will return true because _find([..., {login: A}], (optionToExclude) => optionsToExculde.login === [email protected] return false. That leads to the new user being created and appearing in the search result

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

  • We can add the @expensify.sms with phone number when call API "InviteToRoom" as we did when call API "AddMembersToWorkspace" by updating:
    const inviteeEmails = _.keys(inviteeEmailsToAccountIDs);

    to:
const inviteeEmails = _.keys(inviteeEmailsToAccountIDs).map((login) => addSMSDomainIfPhoneNumber(login));

Additionally, I found out there is a related bug that needs to be fixed (encounters in WorkspaceInvitePage as well):

  • If the member list already contains A, then we type A in the search input, it will display as No results found rather than [email protected] is already a member of Workspace.
  • RCA:
    if (!userToInvite && excludedUsers.includes(searchValue)) {
    return translate('messages.userIsAlreadyMember', {login: searchValue, name: reportName});
    }

    Based on the above logic, we are displaying messages.userIsAlreadyMember only when usersToInvite is empty and excludeUsers includes searchValue. In case phone number A already existed, in excludeUsers it is [email protected], in searchValue it is just A, so the conditions usersToInvite.length === 0 && excludedUsers.includes(searchValue) will be false, leads to the bug.
  • Solution: We should add the trailing @expensify.sms to phone number A when checking if it existed in excludeUsers or not by:
    update:
    if (!userToInvite && excludedUsers.includes(searchValue)) {

    to:
if (usersToInvite.length === 0 && (excludedUsers.includes(searchValue) || excludedUsers.includes(OptionsListUtils.addSMSDomainIfPhoneNumber(searchValue).toLowerCase()))) 

What alternative solutions did you explore? (Optional)

  • NA

Result

Screencast.from.27-10-2023.02.46.47.webm

@melvin-bot
Copy link

melvin-bot bot commented Oct 27, 2023

@greg-schroeder, @rushatgabhane Whoops! This issue is 2 days overdue. Let's get this updated quick!

@greg-schroeder
Copy link
Contributor

awaiting proposal review from @rushatgabhane

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Oct 27, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 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
Copy link

melvin-bot bot commented Oct 31, 2023

@greg-schroeder, @rushatgabhane Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@greg-schroeder
Copy link
Contributor

Bump @rushatgabhane

@melvin-bot melvin-bot bot removed the Overdue label Nov 1, 2023
@rushatgabhane
Copy link
Member

rushatgabhane commented Nov 3, 2023

C+ reviewed 🎀 👀 🎀

I like @DylanDylann's propsoal #30190 (comment)

Copy link

melvin-bot bot commented Nov 3, 2023

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

@melvin-bot melvin-bot bot added the Overdue label Nov 6, 2023
@greg-schroeder greg-schroeder changed the title [HOLD for payment 2024-01-03] [$500] Room - Can invite valid phone account multiple times into the room [$500] Room - Can invite valid phone account multiple times into the room Jan 3, 2024
@DylanDylann
Copy link
Contributor

@greg-schroeder I am working on it, I need to double-check because the latest main has a lot of changes

@greg-schroeder
Copy link
Contributor

Okay got it, thanks!

@greg-schroeder greg-schroeder added Daily KSv2 and removed Weekly KSv2 labels Jan 3, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Jan 4, 2024
@DylanDylann
Copy link
Contributor

The new PR is ready to review

@greg-schroeder
Copy link
Contributor

New PR was merged, awaiting deploy to staging -> prod

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jan 31, 2024
@melvin-bot melvin-bot bot changed the title [$500] Room - Can invite valid phone account multiple times into the room [HOLD for payment 2024-02-07] [$500] Room - Can invite valid phone account multiple times into the room Jan 31, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jan 31, 2024
Copy link

melvin-bot bot commented Jan 31, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Jan 31, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.33-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-02-07. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Jan 31, 2024

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:

  • [@rushatgabhane / @DylanDylann] The PR that introduced the bug has been identified. Link to the PR:
  • [@rushatgabhane / @DylanDylann] 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:
  • [@rushatgabhane / @DylanDylann] 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:
  • [@rushatgabhane / @DylanDylann] Determine if we should create a regression test for this bug.
  • [@rushatgabhane / @DylanDylann] 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.
  • [@greg-schroeder] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@Beamanator
Copy link
Contributor

Seems like the PR for this was reverted again 😬 #35335 so no payment due yet

@greg-schroeder
Copy link
Contributor

RIP

@greg-schroeder greg-schroeder removed the Awaiting Payment Auto-added when associated PR is deployed to production label Feb 6, 2024
@greg-schroeder greg-schroeder changed the title [HOLD for payment 2024-02-07] [$500] Room - Can invite valid phone account multiple times into the room [$500] Room - Can invite valid phone account multiple times into the room Feb 6, 2024
@greg-schroeder
Copy link
Contributor

Are we even going to move forward here at all? It seems this might not actually go forward with another PR based on what @mountiny is saying in the linked PRs

@DylanDylann
Copy link
Contributor

DylanDylann commented Feb 6, 2024

@rushatgabhane @mountiny I cannot reproduce this issue in staging anymore. Can anyone help confirm?

@Beamanator Beamanator added the retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause label Feb 13, 2024
@Beamanator
Copy link
Contributor

Added retest-weekly to get more eyes from applause, would be great if this got fixed automagically somehow 😅 😳

@greg-schroeder
Copy link
Contributor

I also couldn't repro, I think I'm going to close this given two failures to reproduce and also #30190 (comment). Reopen if you disagree

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 Weekly KSv2
Projects
None yet
Development

No branches or pull requests

8 participants