App icon indicating copy to clipboard operation
App copied to clipboard

[$500] Workspace - Invite members to workspace error but user can still join the workspace

Open lanitochka17 opened this issue 1 year ago • 95 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Open 2 users on 2 browsers
  2. B send message to A
  3. A create a workspace
  4. A invite B and invalid user (+252 3 234211), observed an error appearing in 2 users when inviting
  5. A go to announce room and send message
  6. From B, Observe that B can access the room

Expected Result:

When the invite user fails, B cannot access the workspace

Actual Result:

B can access the workspace during invite error

Workaround:

Unknown

Platforms:

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

  • [ ] Android / native
  • [ ] Android / Chrome
  • [ ] iOS / native
  • [ ] iOS / Safari
  • [x] Windows / Chrome
  • [ ] MacOS / Desktop

Version Number: 1.3.55-7

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

https://github.com/Expensify/App/assets/78819774/971f2b38-d29e-48ec-8b3c-3979ff760643

https://github.com/Expensify/App/assets/78819774/a7ea2029-b25d-42d8-a67d-99eecd853888

Expensify/Expensify Issue URL:

Issue reported by: @namhihi237

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~017361e55ce3e1ac2d
  • Upwork Job ID: 1693979555238805504
  • Last Price Increase: 2024-04-25

lanitochka17 avatar Aug 21 '23 14:08 lanitochka17

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

melvin-bot[bot] avatar Aug 21 '23 14:08 melvin-bot[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

melvin-bot[bot] avatar Aug 21 '23 14:08 melvin-bot[bot]

Job added to Upwork: https://www.upwork.com/jobs/~017361e55ce3e1ac2d

melvin-bot[bot] avatar Aug 22 '23 13:08 melvin-bot[bot]

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

melvin-bot[bot] avatar Aug 22 '23 13:08 melvin-bot[bot]

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

melvin-bot[bot] avatar Aug 22 '23 13:08 melvin-bot[bot]

Proposal

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

Invited members to a workspace shows an error but the user can still access the workspace.

What is the root cause of that problem?

The issue title is misleading, the cause of the problem is not that the user is not added. The user is added successfully but the malformed phone number is the cause of the error.

API Response: Screenshot 2023-08-23 at 1 47 33 AM

Error message: "The provided phone number does not match the country you are currently located at, please use your email address instead."

This part assumes that the request failed completely for all users. https://github.com/Expensify/App/blob/0f68829b176458ddb8349bde9921f81805944403/src/libs/actions/Policy.js#L394-L399

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

You should filter out users and only show error message for users that were failed to add, not to all.

WaqasIbrahim avatar Aug 22 '23 20:08 WaqasIbrahim

📣 @WaqasIbrahim! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

melvin-bot[bot] avatar Aug 22 '23 20:08 melvin-bot[bot]

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~018d936bc5c4987b6f

WaqasIbrahim avatar Aug 22 '23 20:08 WaqasIbrahim

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Aug 22 '23 20:08 melvin-bot[bot]

@WaqasIbrahim Thanks for the proposal. Indeed the other user seem to "partly" get access to the workspace. I don't see them in the members list but according to the OP video they can access restricted rooms. This should be handled internally.

s77rt avatar Aug 22 '23 23:08 s77rt

@laurenreidexpensify This seems internal. Can you please apple the label?

s77rt avatar Aug 22 '23 23:08 s77rt

@s77rt You are welcome. Just a suggestion, UX wise this should be handled the same way internally. I (as a user) should not have to reselect the members and add to workspace if last request failed because of one invalid member.

WaqasIbrahim avatar Aug 23 '23 04:08 WaqasIbrahim

Current assignee @s77rt is eligible for the Internal assigner, not assigning anyone new.

melvin-bot[bot] avatar Aug 27 '23 09:08 melvin-bot[bot]

Triggered auto assignment to @bondydaa (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

melvin-bot[bot] avatar Aug 27 '23 09:08 melvin-bot[bot]

@bondydaa this one is internal, so adding engineering for extra eyes

laurenreidexpensify avatar Aug 27 '23 09:08 laurenreidexpensify

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Aug 29 '23 16:08 melvin-bot[bot]

Sorry it's not clear to me here in the steps.

A is a validated user with an existing account? B is a validated user with an existing account but isn't already on the workspace that A owns?

The problem is that if you try to add an existing user and also invite an invalid phone/email the admin gets an error back but B is properly added (as they should be, right?) but the invalid phone/email isn't added, right?

bondydaa avatar Aug 29 '23 16:08 bondydaa

Yes @bondydaa, the Message shows an error for both account B and an invalid phone but actually B has been added success

namhihi237 avatar Aug 29 '23 16:08 namhihi237

I see but B should be and is added right?

I think @WaqasIbrahim was right in their analysis here https://github.com/Expensify/App/issues/25592#issuecomment-1688921768

We are assuming all users failed even though it failed only for 1 user (the invalid phone number)

So I think I agree this is mostly just a front end thing that is incorrectly showing B had an error event though it didn't.

Though I guess I'm not sure if the error thrown states which specific user had the error so maybe we do need to possibly update the API to return that, let me try to confirm that real quick.

bondydaa avatar Aug 29 '23 17:08 bondydaa

Another thing is that in user B, if you open the ws room, you will see Unavailabe instead of the WS name.

namhihi237 avatar Aug 29 '23 17:08 namhihi237

hmm I wasn't logged in to my "B" user here initially but after I logged in looks like the room names are there image

so I bet the error in the API prevent us from hitting the code that should have pushed all the updates out to the right clients.

inspecting the network request it dosen't look like the error has the accountID(s) it failed for image

We could possibly go through the onyx data for the POLICYCHANGELOG_ADD_EMPLOYEE b/c that shows which employee we added image

but that seems kind of hacky to me, I think the API should probably return better which accountIDs were successful and which had errors.

bondydaa avatar Aug 29 '23 17:08 bondydaa

agree, I think it will make it easy for frontend to fix

namhihi237 avatar Aug 29 '23 17:08 namhihi237

wowza I was hoping to make this a first pick but this code is confusing 😭

I believe this is where we are hitting the spot where we try to create the accounts if they don't exist https://github.com/Expensify/Web-Expensify/blob/d506283338f/lib/PolicyAPI.php#L1096 @Beamanator @neil-marcellini I see your names in the blame around here so maybe you have a better idea here 🙏.

Can you think of an easy way of capturing which logins we might have failed for and which ones we didn't fail for that we could then return from the API here?

bondydaa avatar Aug 29 '23 18:08 bondydaa

oh also logs for that request https://www.expensify.com/_devportal/tools/logSearch/#query=request_id%3A%227fe67c237cc65200-DEN%22%20AND%20timestamp%3A%5B2023-08-29T00%3A00%20TO%202023-08-30T23%3A59%5D&index=_all

bondydaa avatar Aug 29 '23 18:08 bondydaa

Do you know exactly what is failing when inviting new members?

If you can get it from $modifyEmployeesResponse that would be nice, but i haven't messed with self::modifyEmployees much, and it's very scary code haha.

If account creation fails, maybe you can tell from Auth::getAccountIDsByEmails? I think that won't return accountIDs for emails that don't exist, and I don't think it'll fail - so you could possibly map out which email you invited but didn't get an accountID?

Beamanator avatar Sep 01 '23 11:09 Beamanator

@bondydaa @s77rt @laurenreidexpensify this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Sep 04 '23 10:09 melvin-bot[bot]

@bondydaa, @s77rt, @laurenreidexpensify Eep! 4 days overdue now. Issues have feelings too...

melvin-bot[bot] avatar Sep 04 '23 10:09 melvin-bot[bot]

Not overdue @bondydaa is OOO today - American holiday

laurenreidexpensify avatar Sep 04 '23 14:09 laurenreidexpensify

Do you know exactly what is failing when inviting new members?

In this exact scenario the failure is because we block trying to create an account for a phone number that is outside of the country you are in... i know super strange and actually probably something we might need to reconsider since there is a legitimate case where an admin could be adding users from a different country.

But I don't think the exact reason matters here much, there could be 42 different reasons why 1 account in a big list that you try to add doesn't work and it shouldn't mark them all as failed in that case.

bondydaa avatar Sep 04 '23 22:09 bondydaa

something we might need to reconsider since there is a legitimate case where an admin could be adding users from a different country.

We have this https://github.com/Expensify/Expensify/issues/262189 already about addressing that problem so not something we need to concern ourselves with here.

This issue should focus on fixing it so that 1 error while adding doesn't mark them all as failing.

bondydaa avatar Sep 05 '23 18:09 bondydaa