3
0

Fix new users theme assignment (#1684)

This commit is contained in:
Mumbi Francis 2024-02-13 13:46:43 +03:00 committed by GitHub
parent e5a9e91f3f
commit 9c6198b512
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View File

@ -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"
@ -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
}

View File

@ -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()