-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[$250] mWeb - room- Inviting a previously unknown user to room displays member count incorrectly #46298
Comments
Triggered auto assignment to @stephanieelliott ( |
We think that this bug might be related to #vip-vsp |
@stephanieelliott FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors |
ProposalPlease re-state the problem that we are trying to solve in this issue.room-Inviting a user who you have no contact before displays member count incorrectly What is the root cause of that problem?The issue is not caused by using the secondary contact to add a member to a room (as indicated in OP) but instead when a user adds a member who's personal detail doesn't exist in onyx a new optimistic personal detail is created then after a while the real personal detail representing the member comes from BE and the optimistic personal detail will be deleted but the accountID of the optimistic personal detail still exists in App/src/pages/ReportDetailsPage.tsx Lines 305 to 306 in b0f810d
What changes do you think we should make in order to solve the problem?We should filter particpants whose personal details doesn't exist just the same as what we did in RoomMemebersPage here App/src/pages/RoomMembersPage.tsx Lines 174 to 180 in b0f810d
We should change App/src/pages/ReportDetailsPage.tsx Lines 138 to 141 in b0f810d
to
We can also check and do the same for workspace members too if needed. What alternative solutions did you explore? (Optional) |
@stephanieelliott the title of the OP is a lit bit misleading as it suggests the problem is caused by using the secondary contact to invite the member but the problem is caused by the member being invited was a member with which the current user had no contact before. So to reproduce it, you should test by adding a member with which you had no contact before. |
ProposalPlease re-state the problem that we are trying to solve in this issue.Inviting user we never chat before to a room will make an extra count to the room member count. What is the root cause of that problem?When we are searching for a new user, the app will generate a random optimistic account ID. App/src/libs/OptionsListUtils.ts Lines 1748 to 1749 in 5e65276
When we invite the user, the app will optimistically merge the generated account ID to the room participants. App/src/libs/actions/Report.ts Lines 2809 to 2836 in 5e65276
However, we never clear the optimistic report participant. This logic is used for both invite to room and group, but the issue doesn't happen in a group chat because the API for invite to group chat returns a response when success that will clears the optimistic report participant. The reason the optimistic participant disappears from the member list is because we skip over members that doesn't have personal details (which are cleared correctly when successful). App/src/pages/RoomMembersPage.tsx Lines 177 to 180 in 5e65276
What changes do you think we should make in order to solve the problem?Fix it in the BE so invite to room also returns a response to clear the optimistic report participant. OR Fix it in the FE by clearing the optimistic report participant in success data. const participantsSuccessData = inviteeAccountIDs.reduce(
(reportParticipants, accountID: number) => ({...reportParticipants, [accountID]: null}),
{},
);
const successData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
participants: participantsSuccessData,
pendingChatMembers: successPendingChatMembers,
},
},
]; |
@stephanieelliott Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Thanks @FitseTLT! I see what you mean -- updated the title and action steps to make that more clear. |
Given that it affects any user you've not previously had contact with (not secondary logins) and persists on the workspace, I think this is worth fixing. Adding labels to get the proposals reviewed. |
Job added to Upwork: https://www.upwork.com/jobs/~01b5145e9ee0c2aee8 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ZhenjaHorbach ( |
I will check proposals today or tomorrow |
@FitseTLT @bernhardoj I agree with @bernhardoj that we can fix this in BE But on the other side If we decide to fix this in FE But first, let's find out what the internal team thinks about where it is best to fix it |
Triggered auto assignment to @dangrous, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Okay yep, I think it makes the most sense to copy the group chat behavior on the backend. I should be able to get to that early next week! To confirm, if we do that, we shouldn't need any front end fixes, right? |
Since inviting to a group chat works correctly |
This did need an incredibly minor front end adjustment, so I went ahead and did that myself. Both PRs will be in review in a sec! |
The second PR is held on #46825 which is merged but not yet on prod , so we should be able to resume this soon. |
still waiting on deploy to prod, will likely be Monday due to earnings, Friday... |
we should be able to test this again on staging and hopefully close out! |
So this ends up with the correct amount, but it takes a while to get there. It doesn't get higher than it should but if I'm the only person in a room and then I invite another person, it stays 1 for a while, before switching to 2. @ZhenjaHorbach (or others) do you want to give this a look and see if there's anything we can do optimistically on the front end that might make this cleaner? Or if I need to update the backend again we can do that. |
Could you provide a video, please ? |
Oh weird! I just tested again (in order to take the video) and it works like a charm. Maybe something was happening on the backend. Are we good to close, or do we need any payments handled? |
Following the new rules and if i understand correctly But if not, then I think we can close this issue ! |
Ah yep that seems right to me! cc @stephanieelliott |
Hey @ZhenjaHorbach I extended the offer to you in Upwork, can you accept when you get a sec? https://www.upwork.com/nx/wm/offer/103546715 |
Done, thanks ! |
Summarizing payment on this issue:
Upwork job is here: https://www.upwork.com/jobs/~01b5145e9ee0c2aee8 |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.13
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team
Action Performed:
and invite to room
Expected Result:
Inviting an user to room via secondary contact must display member count correctly
Actual Result:
Inviting an user to room via secondary contact must display member count correctly
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6552594_1721908859939.uu122.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @ZhenjaHorbachThe text was updated successfully, but these errors were encountered: