Skip to content

Commit

Permalink
Merge pull request #165 from ppolariss/main
Browse files Browse the repository at this point in the history
fix: #163
  • Loading branch information
ppolariss authored Nov 9, 2024
2 parents 9970114 + 2f1daf8 commit 71615ea
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions apis/user/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,23 @@ func ModifyUser(c *fiber.Ctx) error {
return err
}

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

err = modifyUser(c, &newUser, body)
err = modifyUser(c, user, body)
if err != nil {
return err
}

return c.JSON(&newUser)
return c.JSON(user)
}

// ModifyCurrentUser
Expand Down

0 comments on commit 71615ea

Please sign in to comment.