Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
2.99k stars 2.5k forks source link

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

Open lanitochka17 opened 9 months ago

lanitochka17 commented 9 months ago

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. 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?

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-05-02
Issue OwnerCurrent Issue Owner: @bondydaa
melvin-bot[bot] commented 9 months ago

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

melvin-bot[bot] commented 9 months ago

Bug0 Triage Checklist (Main S/O)

melvin-bot[bot] commented 9 months ago

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

melvin-bot[bot] commented 9 months ago

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

melvin-bot[bot] commented 9 months ago

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

WaqasIbrahim commented 9 months ago

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.

melvin-bot[bot] commented 9 months ago

📣 @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>
WaqasIbrahim commented 9 months ago

Contributor details Your Expensify account email: waqas.abrahim@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~018d936bc5c4987b6f

melvin-bot[bot] commented 9 months ago

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

s77rt commented 9 months ago

@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 commented 9 months ago

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

WaqasIbrahim commented 9 months ago

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

melvin-bot[bot] commented 8 months ago

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

melvin-bot[bot] commented 8 months ago

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

laurenreidexpensify commented 8 months ago

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

melvin-bot[bot] commented 8 months ago

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

bondydaa commented 8 months ago

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?

namhihi237 commented 8 months ago

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

bondydaa commented 8 months ago

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.

namhihi237 commented 8 months ago

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

bondydaa commented 8 months ago

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.

namhihi237 commented 8 months ago

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

bondydaa commented 8 months ago

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 commented 8 months ago

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

Beamanator commented 8 months ago

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?

melvin-bot[bot] commented 8 months ago

@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] commented 8 months ago

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

laurenreidexpensify commented 8 months ago

Not overdue @bondydaa is OOO today - American holiday

bondydaa commented 8 months ago

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 commented 8 months ago

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.

melvin-bot[bot] commented 8 months ago

@bondydaa @s77rt @laurenreidexpensify this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!

melvin-bot[bot] commented 8 months ago

@bondydaa, @s77rt, @laurenreidexpensify Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] commented 8 months ago

@bondydaa @s77rt @laurenreidexpensify this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!

melvin-bot[bot] commented 8 months ago

@bondydaa, @s77rt, @laurenreidexpensify Huh... This is 4 days overdue. Who can take care of this?

laurenreidexpensify commented 8 months ago

@bondydaa @s77rt what do we think next steps are/

s77rt commented 8 months ago

@laurenreidexpensify I think @bondydaa may answer this better. I don't have access to https://github.com/Expensify/Expensify/issues/262189

bondydaa commented 8 months ago

next steps are to fix the API, not sure this needs to be a daily or in /App since this will need to be fix primarily in the API though maybe it does need some front end changes.

I don't really have the bandwidth right now to focus on it though.

melvin-bot[bot] commented 8 months ago

@bondydaa @s77rt @laurenreidexpensify this issue is now 4 weeks old and preventing us from maintaining WAQ. This should now be your highest priority. Please post below what your plan is to get a PR in review ASAP. Thanks!

laurenreidexpensify commented 8 months ago

Making this a weekly

laurenreidexpensify commented 7 months ago

This is still fine as a weekly

laurenreidexpensify commented 7 months ago

@bondydaa any capacity to check this out yet?

laurenreidexpensify commented 7 months ago

@bondydaa bump - are you able to look into it yet?

bondydaa commented 6 months ago

sorry no not really, need to focus on finishing off the recarding doc so mostly heads down on that.

bondydaa commented 6 months ago

haven't got back into this yet, other projects still taking priority atm.

bondydaa commented 6 months ago

still haven't had time to dig back in here

bondydaa commented 5 months ago

still no update, uspm and other chores still taking priority. have to focus on recarding issues and PCI next week.

bondydaa commented 5 months ago

still haven't gotten back to this, I'm going to demote it to monthly since it's been months and nothing bad has happened.

I agree we should still fix this at some point but I have other priorities that need to get wrapped up before EOY. I'll bring it up on the resync engineering threads to see if someone can take it over though as well.

bondydaa commented 5 months ago

posted this here https://expensify.slack.com/archives/CC7NECV4L/p1702496004198239?thread_ts=1702417170.002649&cid=CC7NECV4L trying to see if someone else can take it over

melvin-bot[bot] commented 4 months ago

This issue has not been updated in over 15 days. @bondydaa, @s77rt, @laurenreidexpensify eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

bondydaa commented 3 months ago

trying to see what wave this might fall under to see if we can hand it off b/c I'm still focused on getting USPM out the door.