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

Reloading `CurrentUserStore` when updated user is the current user. #2706

Merged
merged 1 commit into from Aug 18, 2016

Conversation

Projects
None yet
2 participants
@dennisoelkers
Member

dennisoelkers commented Aug 17, 2016

Description

The UserForm component now triggers a reload of the CurrentUserStore when it is updating the user which is currently logged in.

Motivation and Context

Before this change, the current user object was stale after updating it.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Fixes #2705.

@@ -111,6 +111,9 @@ const UserForm = React.createClass({
if (this.isPermitted(this.state.currentUser.permissions, ['users:list'])) {
this.props.history.replaceState(null, Routes.SYSTEM.AUTHENTICATION.USERS.LIST);
}
if (this.props.user.username === this.state.currentUser.username) {
CurrentUserStore.reload();
}

This comment has been minimized.

@edmundoa

edmundoa Aug 17, 2016

Member

I was wondering, shouldn't we do the same when updating permissions or roles? If so, maybe we should trigger the reload from the (ancient) UsersStore, or even take the time to convert it to a Reflux store. We should probably wait for that until 2.1 is out, though.

This comment has been minimized.

@dennisoelkers

dennisoelkers Aug 17, 2016

Member

Yes, I think we need to. I would vote for refactoring the UsersStore into a Reflux store. 👍

This comment has been minimized.

@edmundoa

edmundoa Aug 18, 2016

Member

Ok, I'll create a follow up task for that 👍

@edmundoa edmundoa self-assigned this Aug 18, 2016

@edmundoa

This comment has been minimized.

Member

edmundoa commented Aug 18, 2016

LGTM 👍

@edmundoa edmundoa merged commit 4557795 into master Aug 18, 2016

4 checks passed

ci-server-integration Jenkins build graylog2-server-integration-pr 1292 has succeeded
Details
ci-web-linter Jenkins build graylog-pr-linter-check 775 has succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@edmundoa edmundoa deleted the issue-2705 branch Aug 18, 2016

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