Skip to content

Commit

Permalink
fix(favorites): allow update favorites in platform admin endpoint (#108)
Browse files Browse the repository at this point in the history
* update favorites in platform admin endpoint

* fix active update

* revert

* allow set admin as well
  • Loading branch information
plyr4 authored Feb 19, 2020
1 parent 15cb44a commit 6fffb60
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion api/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,20 @@ func UpdateUser(c *gin.Context) {

// update user fields if provided
if input.GetActive() {
// update active if set
// update active if set to true
u.SetActive(input.GetActive())
}

if input.GetAdmin() {
// update admin if set to true
u.SetAdmin(input.GetAdmin())
}

if input.Favorites != nil {
// update favorites if set
u.SetFavorites(input.GetFavorites())
}

// send API call to update the user
err = database.FromContext(c).UpdateUser(u)
if err != nil {
Expand Down

0 comments on commit 6fffb60

Please sign in to comment.