Skip to content

Commit

Permalink
fix: not found and get actually modified user in ModifyUser
Browse files Browse the repository at this point in the history
  • Loading branch information
ppolariss committed Oct 10, 2024
1 parent b01b6a1 commit 2f1daf8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions apis/user/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,12 @@ func ModifyUser(c *fiber.Ctx) error {
return err
}

// has_answered_questions will be invalid when user changes other user's profile
// cannot get field "has_answered_questions" when admin changes other user's config
if user.ID != userID {
err = DB.First(&user, userID).Error
user = &User{
ID: userID,
}
err = DB.Take(user).Error
if err != nil {
return err
}
Expand Down

0 comments on commit 2f1daf8

Please sign in to comment.