Skip to content
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

Updating user now updates activity feed. #18962

Merged
merged 2 commits into from
May 14, 2024
Merged

Conversation

getvictor
Copy link
Member

#18766
Fixed a bug where updating user via /api/v1/fleet/users/:id endpoint sometimes did not update the activity feed and returned the un-updated user object.

You must use a DB configuration with a replica to reproduce the issue.

Checklist for submitter

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    See Changes files for more information.
  • Added/updated tests
  • Manual QA for all new/changed functionality

…sometimes did not update the activity feed and returned the un-updated user object.
@getvictor getvictor marked this pull request as ready for review May 14, 2024 14:42
@getvictor getvictor requested a review from a team as a code owner May 14, 2024 14:42
// Since we just modified the user and the changes may not have replicated to the read replica(s) yet,
// we must use the master to ensure we get the most up-to-date information.
ctxUsePrimary := ctxdb.RequirePrimary(ctx, true)
user, err = svc.User(ctxUsePrimary, userID)
Copy link
Member

@lucasmrod lucasmrod May 14, 2024

Choose a reason for hiding this comment

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

Another approach is for svc.ds.SaveUser itself (and svc.saveUser(ctx, user)) to return the updated user.

Copy link
Member

@lucasmrod lucasmrod left a comment

Choose a reason for hiding this comment

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

LGTM!

@getvictor getvictor merged commit 8d253fe into main May 14, 2024
15 of 16 checks passed
@getvictor getvictor deleted the victor/18766-updating-user branch May 14, 2024 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants