-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix: Cannot remove RBR when invite an invalid member to workspace #23157
Merged
NikkiWines
merged 8 commits into
Expensify:main
from
tienifr:fix/22359-can-not-remove-rbr-invite-workspace-member
Jul 26, 2023
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a5a6b64
fix: cannot remove rbr when invite an invalid workspace member
tienifr 304a5e6
exclude current account id
tienifr 012b2aa
refactor using chain
tienifr 9d734b9
dummy account ID length
tienifr ca996a6
isDummy account
tienifr 78f8ba1
change isDummy to isOptimisticData
tienifr b3998dc
remove isOptimisticData
tienifr 9eba1dd
remove isOptimisticData
tienifr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actually need
isDummy
? We are able to get the personalDetails to be removed inclearDeleteMemberError
clearAddMemberError
byaccountID
. Tested locally and seemed to work fine without including this(edited function name)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I guess for the cases where we have an error we want to dismiss but where we don't want to remove that user from the policy details 🤔 Though... do we have a case like that? I don't think so?
If we do (and it's entirely possible I'm missing/unaware of some flow like that) I guess I would call this something a little more descriptive like
isOptimisticDetails
/isOptimisicData
or something like that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error is cleared in
clearAddMemberError
, not delete. The point is to remove the invalid personal details on clearing the error. Otherwise, those invalid details would still be shown in the invite suggestion page. AndisDummy
is to check for those invalid ones. I've tried removingisDummy
but it didn't work.Also,
isOptimisticData
sounds great to me, thanks for the suggestion.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, sorry, you're right about that, I mistyped the function name. But the comment still holds, why do we need
isDummy
/isOptimisticData
if we can remove the optimistically added member byaccountID
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, sorry I might not understand your point. Inside
clearAddMemberError
we only remove theaccountID
from the policy's members listONYXKEYS.COLLECTION.POLICY_MEMBERS
but we haven't remove it from personal details list, which we should do as explained above:Also as you've mentioned here:
Can you elaborate on the test you've made?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, I'm not explaining things very clearly 😅 Effectively, I'm not sure I understand why we need to include the
isOptimisticData
value at all.The logic you have here conditionally retrieves the personal details that match the
accountID
and whereisOptimisticData = true
, and then removes those details fromONYXKEYS.PERSONAL_DETAILS_LIST
, right?But whenever we call
clearAddMemberError
, we're going to want to updateONYXKEYS.PERSONAL_DETAILS_LIST
to remove the details for the providedaccountID
, because that user won't have been added to the workspace successfully. We can do this based onaccountID
alone, so why do we needisOptimisticData = true
as a condition to be met?Hopefully, that's a bit clearer? Let me know if I'm misunderstanding something or if it's still unclear.
Yeah, for sure. I just removed this line and adjusted this line to be as follows:
Then retested using the testing steps for this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! Thanks for your patience and detailed explanation. At first we tried to only remove the "dummy" account personal details but there's no way to do it. But as mentioned above, we should remove all errored account from personal details list.
Please check again!