Skip to content

Commit

Permalink
Merge pull request #171 from jovandeginste/fix-profile-checks
Browse files Browse the repository at this point in the history
Fix disabling options in profile settings
  • Loading branch information
jovandeginste committed Jun 13, 2024
2 parents 9a44006 + 18d9b44 commit a71b712
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/app/self_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ func (a *App) userProfileUpdateHandler(c echo.Context) error {
u := a.getCurrentUser(c)
p := &u.Profile

p.ResetBools()

if err := c.Bind(p); err != nil {
return a.redirectWithError(c, a.echo.Reverse("user-profile"), err)
}
Expand Down
6 changes: 6 additions & 0 deletions pkg/database/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ func (u UserPreferredUnits) Speed() string {
}
}

func (p *Profile) ResetBools() {
p.PreferFullDate = false
p.APIActive = false
p.SocialsDisabled = false
}

func (p *Profile) Save(db *gorm.DB) error {
return db.Save(p).Error
}
Expand Down

0 comments on commit a71b712

Please sign in to comment.