Skip to content

Conversation

@evansiroky
Copy link
Contributor

fixes #408

@codecov-io
Copy link

codecov-io commented Feb 6, 2019

Codecov Report

Merging #409 into dev will decrease coverage by 0.13%.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff            @@
##             dev    #409      +/-   ##
========================================
- Coverage    5.3%   5.16%   -0.14%     
========================================
  Files        322     323       +1     
  Lines      15456   16003     +547     
  Branches    4655    4955     +300     
========================================
+ Hits         820     827       +7     
- Misses     12495   12876     +381     
- Partials    2141    2300     +159
Impacted Files Coverage Δ
lib/manager/actions/user.js 0% <0%> (ø) ⬆️
lib/manager/actions/status.js 13.6% <0%> (-4.1%) ⬇️
lib/gtfs/util/graphql.js 33.8% <0%> (-1.5%) ⬇️
lib/gtfs/util/index.js 4.05% <0%> (-0.27%) ⬇️
lib/alerts/reducers/alerts.js 11.84% <0%> (-0.16%) ⬇️
lib/alerts/components/ModeSelector.js 0% <0%> (ø) ⬆️
lib/gtfsplus/components/GtfsPlusField.js 0% <0%> (ø) ⬆️
lib/editor/components/EntityList.js 0% <0%> (ø) ⬆️
lib/public/components/PublicHeader.js 0% <0%> (ø) ⬆️
lib/gtfs/components/gtfs-search.js 0% <0%> (ø) ⬆️
... and 22 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ac5a6a...7c95ddc. Read the comment docs.

Copy link
Contributor

@landonreed landonreed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for identifying this fix. One comment that I would like to address.

// to be dispatched because the status message from the
// updatingUserData is still set to something, so we need to indicate
// that the request completed.
dispatch(clearStatusMessage())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if rather than clearing the status message, we might want to replace the user profile that has been updated with the one contained in the store or alternatively, just fetch the user list again. Either way I think updating the user with its up-to-date info so that the user can verify the update matches their desired change is important.

@landonreed landonreed assigned evansiroky and unassigned landonreed Feb 13, 2019
@evansiroky evansiroky requested a review from a team February 28, 2019 19:57
@evansiroky
Copy link
Contributor Author

I refactored this so that an error message is shown when the update fails and that the user list is refreshed upon success.

@evansiroky evansiroky assigned landonreed and unassigned evansiroky Feb 28, 2019
Copy link
Contributor

@landonreed landonreed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evansiroky, I'm a bit confused about the new code. Could you explain why the logic to check if the updated user matches the current user was removed? Also, why does the error message say "Could not find user metadata"? That doesn't seem appropriate.

@landonreed landonreed assigned evansiroky and unassigned landonreed Mar 6, 2019
@evansiroky
Copy link
Contributor Author

The new code changes the behavior after a successful update so that the user list is refreshed each time. Therefore, the check to update is no longer needed, because the most recent data gets refetched.

That error message was copy-pasta-no-updata. Pushed a fix for that.

@evansiroky evansiroky assigned landonreed and unassigned evansiroky Mar 7, 2019
@landonreed landonreed assigned evansiroky and unassigned landonreed Mar 11, 2019
@evansiroky
Copy link
Contributor Author

Just added back logic to update current user permissions after a self-update is performed.

@evansiroky evansiroky assigned landonreed and unassigned evansiroky Mar 15, 2019
// may affect what they're allowed to do in the application.
dispatch(userProfileUpdated(responseJson))
}
dispatch(fetchUsers())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think fetchUsers should always be called. This function is called in other places besides the user admin module (e.g., updateTargetForSubscription). So when a user updates their own subscriptions, we really don't want to be fetching all users. This was the original purpose of the code that updates the logged in user that was removed in a previous commit (and was added back here). Given how much confusion has surrounded this relatively minor code change, I think you should update this method's doc to read:

Update application/client ID specific datatools object with provided user data. This is used in the user admin module to update some user's permissions as well as throughout the application to update attributes for the logged in user (e.g., when a user subscribes/watches a feed source or project).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow, yeah, I didn't realize how widely this action was used and how often times it's for updating subscriptions and other non-permissions stuff.

@landonreed landonreed assigned evansiroky and unassigned landonreed Mar 26, 2019
- add more comments
- only fetch users after update if the user being updated was not the current user
@evansiroky
Copy link
Contributor Author

I added more comments and refactored as suggest.

@evansiroky evansiroky assigned landonreed and unassigned evansiroky Mar 29, 2019
@landonreed landonreed merged commit ad6a2d2 into dev Mar 29, 2019
@landonreed landonreed deleted the update-user-fix branch March 29, 2019 11:56
@landonreed
Copy link
Contributor

🎉 This PR is included in version 4.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When updating a user other than the currently logged in user, the status message will not be cleared properly

4 participants