This repository has been archived by the owner on May 19, 2020. It is now read-only.
Do not allow role checkboxes to update in error cases #1118
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.
Solves: https://favro.com/card/1e11108a2da81e3bd7153a7a/18F-5842
The problem was that even though there was an error from trying to
associate/dissociate spaces roles or just dissociate org roles, the
checkboxes would still reflect because addedUserRoles / deletedUserRoles
actions would be called.
This PR moves addedUserRoles and deletedUserRoles to in another place in
the promise chain.
Now, after succeeding with deleteSpaceUserPermissions and
deleteOrgUserPermissions, the deletedUserRoles action is called in error
either, it will call errorRemoveUser (which will be used for raising
errors to UI)
The problem with the association of space roles was that it was not
passing the error back up like the org space association. This PR
mirrors that same behavior. (There is no errorAddUser action right now
so no need to call that.)
There are tests in this PR to test that in success cases addedUserRoles
and deletedUserRoles actions are called. Also the tests test to make
sure those actions are NOT called in the case of an error.
Also added moxios so that we can easily test the axios library. (it's by the same author)
Also, this fixes typos.