88 "context"
99 "encoding/hex"
1010 "fmt"
11+ _ "image/jpeg" // Needed for jpeg support
1112 "mime"
1213 "net/mail"
1314 "net/url"
@@ -18,8 +19,6 @@ import (
1819 "time"
1920 "unicode"
2021
21- _ "image/jpeg" // Needed for jpeg support
22-
2322 "code.gitea.io/gitea/models/auth"
2423 "code.gitea.io/gitea/models/db"
2524 "code.gitea.io/gitea/modules/auth/openid"
@@ -200,7 +199,7 @@ func (u *User) BeforeUpdate() {
200199// AfterLoad is invoked from XORM after filling all the fields of this object.
201200func (u * User ) AfterLoad () {
202201 if u .Theme == "" {
203- u .Theme = setting .UI .DefaultTheme
202+ u .Theme = setting .Config (). UI .DefaultTheme . Value ( context . Background ())
204203 }
205204}
206205
@@ -441,7 +440,7 @@ func (u *User) EmailTo() string {
441440// GetDisplayName returns full name if it's not empty and DEFAULT_SHOW_FULL_NAME is set,
442441// returns username otherwise.
443442func (u * User ) GetDisplayName () string {
444- if setting .UI .DefaultShowFullName {
443+ if setting .Config (). UI .DefaultShowFullName . Value ( context . Background ()) {
445444 trimmed := strings .TrimSpace (u .FullName )
446445 if len (trimmed ) > 0 {
447446 return trimmed
@@ -483,7 +482,7 @@ func (u *User) GitName() string {
483482
484483// ShortName ellipses username to length
485484func (u * User ) ShortName (length int ) string {
486- if setting .UI .DefaultShowFullName && len (u .FullName ) > 0 {
485+ if setting .Config (). UI .DefaultShowFullName . Value ( context . Background ()) && len (u .FullName ) > 0 {
487486 return util .EllipsisDisplayString (u .FullName , length )
488487 }
489488 return util .EllipsisDisplayString (u .Name , length )
@@ -662,7 +661,7 @@ func createUser(ctx context.Context, u *User, meta *Meta, createdByAdmin bool, o
662661 u .AllowCreateOrganization = setting .Service .DefaultAllowCreateOrganization && ! setting .Admin .DisableRegularOrgCreation
663662 u .EmailNotificationsPreference = setting .Admin .DefaultEmailNotification
664663 u .MaxRepoCreation = - 1
665- u .Theme = setting .UI .DefaultTheme
664+ u .Theme = setting .Config (). UI .DefaultTheme . Value ( ctx )
666665 u .IsRestricted = setting .Service .DefaultUserIsRestricted
667666 u .IsActive = ! (setting .Service .RegisterEmailConfirm || setting .Service .RegisterManualConfirm )
668667
@@ -1394,7 +1393,7 @@ func FixWrongUserType(ctx context.Context) (int64, error) {
13941393}
13951394
13961395func GetOrderByName () string {
1397- if setting .UI .DefaultShowFullName {
1396+ if setting .Config (). UI .DefaultShowFullName . Value ( context . Background ()) {
13981397 return "full_name, name"
13991398 }
14001399 return "name"
0 commit comments