Skip to content

Commit

Permalink
Fix new users theme assignment (#1684)
Browse files Browse the repository at this point in the history
  • Loading branch information
KinyaElGrande authored Feb 13, 2024
1 parent e5a9e91 commit 9c6198b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 8 additions & 0 deletions server/system/service/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/cortezaproject/corteza/server/pkg/eventbus"
"github.com/cortezaproject/corteza/server/pkg/handle"
"github.com/cortezaproject/corteza/server/pkg/payload"
"github.com/cortezaproject/corteza/server/pkg/sass"
"github.com/cortezaproject/corteza/server/store"
"github.com/cortezaproject/corteza/server/system/service/event"
"github.com/cortezaproject/corteza/server/system/types"
Expand Down Expand Up @@ -382,6 +383,13 @@ func (svc *auth) InternalSignUp(ctx context.Context, input *types.User, password
createUserHandle(ctx, svc.store, nUser)
}

if nUser.Meta == nil {
nUser.Meta = &types.UserMeta{}
}

//set default user's theme
nUser.Meta.Theme = sass.LightTheme

if err = uniqueUserCheck(ctx, svc.store, nUser); err != nil {
return err
}
Expand Down
8 changes: 6 additions & 2 deletions server/system/service/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,14 +388,18 @@ func (svc user) Create(ctx context.Context, new *types.User) (u *types.User, err
return
}

//add default user's theme
new.Meta.Theme = sass.LightTheme
if new.Meta == nil {
new.Meta = &types.UserMeta{}
}

// Process avatar initials Image
if err = svc.generateUserAvatarInitial(ctx, new); err != nil {
return
}

//add default user's theme
new.Meta.Theme = sass.LightTheme

new.ID = nextID()
new.CreatedAt = *now()

Expand Down

0 comments on commit 9c6198b

Please sign in to comment.