Skip to content

Commit

Permalink
Merge pull request #144 from jovandeginste/fix-profile-create
Browse files Browse the repository at this point in the history
Improve the creation of a user profile
  • Loading branch information
jovandeginste authored May 11, 2024
2 parents 3d9e11e + a7f0f61 commit ab39dfe
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions pkg/app/self_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,13 @@ func (a *App) userProfilePreferredUnitsUpdateHandler(c echo.Context) error {

func (a *App) userProfileUpdateHandler(c echo.Context) error {
u := a.getCurrentUser(c)
p := &database.Profile{}
p := &u.Profile

if err := c.Bind(p); err != nil {
return a.redirectWithError(c, a.echo.Reverse("user-profile"), err)
}

u.Profile.User = u
u.Profile.APIActive = p.APIActive
u.Profile.Language = p.Language
u.Profile.TotalsShow = p.TotalsShow
u.Profile.Timezone = p.Timezone
u.Profile.AutoImportDirectory = p.AutoImportDirectory
u.Profile.SocialsDisabled = p.SocialsDisabled
u.Profile.PreferFullDate = p.PreferFullDate
p.UserID = u.ID

if err := u.Profile.Save(a.db); err != nil {
return a.redirectWithError(c, a.echo.Reverse("user-profile"), err)
Expand Down

0 comments on commit ab39dfe

Please sign in to comment.