Skip to content

Commit efa54ed

Browse files
committed
remove
1 parent d675e9a commit efa54ed

File tree

31 files changed

+124
-205
lines changed

31 files changed

+124
-205
lines changed

custom/conf/app.example.ini

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,24 +1286,20 @@ LEVEL = Info
12861286
;CODE_COMMENT_LINES = 4
12871287
;;
12881288
;; Max size of files to be displayed (default is 8MiB)
1289-
;; Deprecated in v1.24
12901289
;MAX_DISPLAY_FILE_SIZE = 8388608
12911290
;;
12921291
;; Detect ambiguous unicode characters in file contents and show warnings on the UI
1293-
;; Deprecated in v1.24
12941292
;AMBIGUOUS_UNICODE_DETECTION = true
12951293
;;
12961294
;; Whether the email of the user should be shown in the Explore Users page
12971295
;; Deprecated in v1.24
12981296
;SHOW_USER_EMAIL = true
12991297
;;
13001298
;; Set the default theme for the Gitea install
1301-
;; Deprecated in v1.24
13021299
;DEFAULT_THEME = gitea-auto
13031300
;;
13041301
;; All available themes. Allow users select personalized themes regardless of the value of `DEFAULT_THEME`.
13051302
;; Leave it empty to allow users to select any theme from "{CustomPath}/public/assets/css/theme-*.css"
1306-
;; Deprecated in v1.24
13071303
;THEMES =
13081304
;;
13091305
;; All available reactions users can choose on issues/prs and comments.
@@ -1340,7 +1336,6 @@ LEVEL = Info
13401336
;;
13411337
;; The tense all timestamps should be rendered in. Possible values are `absolute` time (i.e. 1970-01-01, 11:59) and `mixed`.
13421338
;; `mixed` means most timestamps are rendered in relative time (i.e. 2 days ago).
1343-
;; Deprecated in v1.24
13441339
;PREFERRED_TIMESTAMP_TENSE = mixed
13451340

13461341
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

models/user/user.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,11 @@ func (u *User) BeforeUpdate() {
196196
u.Description = util.TruncateRunes(u.Description, 255)
197197
}
198198

199-
func (u *User) GetTheme(ctx context.Context) string {
199+
// AfterLoad is invoked from XORM after filling all the fields of this object.
200+
func (u *User) AfterLoad() {
200201
if u.Theme == "" {
201-
return setting.Config().UI.DefaultTheme.Value(ctx)
202+
u.Theme = setting.UI.DefaultTheme
202203
}
203-
return u.Theme
204204
}
205205

206206
// SetLastLogin set time to last login
@@ -661,7 +661,7 @@ func createUser(ctx context.Context, u *User, meta *Meta, createdByAdmin bool, o
661661
u.AllowCreateOrganization = setting.Service.DefaultAllowCreateOrganization && !setting.Admin.DisableRegularOrgCreation
662662
u.EmailNotificationsPreference = setting.Admin.DefaultEmailNotification
663663
u.MaxRepoCreation = -1
664-
u.Theme = setting.Config().UI.DefaultTheme.Value(ctx)
664+
u.Theme = setting.UI.DefaultTheme
665665
u.IsRestricted = setting.Service.DefaultUserIsRestricted
666666
u.IsActive = !(setting.Service.RegisterEmailConfirm || setting.Service.RegisterManualConfirm)
667667

models/user/user_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ func TestCreateUserInvalidEmail(t *testing.T) {
240240
Email: "[email protected]\r\n",
241241
Passwd: ";p['////..-++']",
242242
IsAdmin: false,
243-
Theme: setting.Config().UI.DefaultTheme.Value(t.Context()),
243+
Theme: setting.UI.DefaultTheme,
244244
MustChangePassword: false,
245245
}
246246

modules/charset/escape.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func EscapeControlHTML(ctx context.Context, html template.HTML, locale translati
3030

3131
// EscapeControlReader escapes the unicode control sequences in a provided reader of HTML content and writer in a locale and returns the findings as an EscapeStatus
3232
func EscapeControlReader(ctx context.Context, reader io.Reader, writer io.Writer, locale translation.Locale, allowed ...rune) (escaped *EscapeStatus, err error) {
33-
if !setting.Config().UI.AmbiguousUnicodeDetection.Value(ctx) {
33+
if !setting.UI.AmbiguousUnicodeDetection {
3434
_, err = io.Copy(writer, reader)
3535
return &EscapeStatus{}, err
3636
}

modules/charset/escape_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"testing"
1010

1111
"code.gitea.io/gitea/modules/setting"
12-
"code.gitea.io/gitea/modules/setting/config"
1312
"code.gitea.io/gitea/modules/test"
1413
"code.gitea.io/gitea/modules/translation"
1514

@@ -173,12 +172,10 @@ func TestEscapeControlReader(t *testing.T) {
173172
}
174173

175174
func TestSettingAmbiguousUnicodeDetection(t *testing.T) {
176-
ambiguousUnicodeDetectionValue := setting.Config().UI.AmbiguousUnicodeDetection.Value(t.Context())
177-
defer test.MockVariableValue(&ambiguousUnicodeDetectionValue, true)()
175+
defer test.MockVariableValue(&setting.UI.AmbiguousUnicodeDetection, true)()
178176
_, out := EscapeControlHTML(t.Context(), "a test", &translation.MockLocale{})
179177
assert.EqualValues(t, `a<span class="escaped-code-point" data-escaped="[U+00A0]"><span class="char"> </span></span>test`, out)
180-
ambiguousUnicodeDetection := config.Value[bool]{}
181-
setting.Config().UI.AmbiguousUnicodeDetection = ambiguousUnicodeDetection.WithDefault(false)
178+
setting.UI.AmbiguousUnicodeDetection = false
182179
_, out = EscapeControlHTML(t.Context(), "a test", &translation.MockLocale{})
183180
assert.EqualValues(t, `a test`, out)
184181
}

modules/issue/template/unmarshal.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
package template
55

66
import (
7-
"context"
87
"fmt"
98
"io"
109
"path"
@@ -43,31 +42,31 @@ func Unmarshal(filename string, content []byte) (*api.IssueTemplate, error) {
4342
}
4443

4544
// UnmarshalFromEntry parses out a valid template from the blob in entry
46-
func UnmarshalFromEntry(ctx context.Context, entry *git.TreeEntry, dir string) (*api.IssueTemplate, error) {
47-
return unmarshalFromEntry(ctx, entry, path.Join(dir, entry.Name())) // Filepaths in Git are ALWAYS '/' separated do not use filepath here
45+
func UnmarshalFromEntry(entry *git.TreeEntry, dir string) (*api.IssueTemplate, error) {
46+
return unmarshalFromEntry(entry, path.Join(dir, entry.Name())) // Filepaths in Git are ALWAYS '/' separated do not use filepath here
4847
}
4948

5049
// UnmarshalFromCommit parses out a valid template from the commit
51-
func UnmarshalFromCommit(ctx context.Context, commit *git.Commit, filename string) (*api.IssueTemplate, error) {
50+
func UnmarshalFromCommit(commit *git.Commit, filename string) (*api.IssueTemplate, error) {
5251
entry, err := commit.GetTreeEntryByPath(filename)
5352
if err != nil {
5453
return nil, fmt.Errorf("get entry for %q: %w", filename, err)
5554
}
56-
return unmarshalFromEntry(ctx, entry, filename)
55+
return unmarshalFromEntry(entry, filename)
5756
}
5857

5958
// UnmarshalFromRepo parses out a valid template from the head commit of the branch
60-
func UnmarshalFromRepo(ctx context.Context, repo *git.Repository, branch, filename string) (*api.IssueTemplate, error) {
59+
func UnmarshalFromRepo(repo *git.Repository, branch, filename string) (*api.IssueTemplate, error) {
6160
commit, err := repo.GetBranchCommit(branch)
6261
if err != nil {
6362
return nil, fmt.Errorf("get commit on branch %q: %w", branch, err)
6463
}
6564

66-
return UnmarshalFromCommit(ctx, commit, filename)
65+
return UnmarshalFromCommit(commit, filename)
6766
}
6867

69-
func unmarshalFromEntry(ctx context.Context, entry *git.TreeEntry, filename string) (*api.IssueTemplate, error) {
70-
if size := entry.Blob().Size(); size > setting.Config().UI.MaxDisplayFileSize.Value(ctx) {
68+
func unmarshalFromEntry(entry *git.TreeEntry, filename string) (*api.IssueTemplate, error) {
69+
if size := entry.Blob().Size(); size > setting.UI.MaxDisplayFileSize {
7170
return nil, fmt.Errorf("too large: %v > MaxDisplayFileSize", size)
7271
}
7372

modules/markup/markdown/markdown.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func render(ctx *markup.RenderContext, input io.Reader, output io.Writer) error
156156
converter := SpecializedMarkdown(ctx)
157157
lw := &limitWriter{
158158
w: output,
159-
limit: setting.Config().UI.MaxDisplayFileSize.Value(ctx) * 3,
159+
limit: setting.UI.MaxDisplayFileSize * 3,
160160
}
161161

162162
// FIXME: should we include a timeout to abort the renderer if it takes too long?

modules/setting/config.go

Lines changed: 66 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package setting
55

66
import (
77
"context"
8-
"strings"
98
"sync"
109

1110
"code.gitea.io/gitea/modules/log"
@@ -54,86 +53,64 @@ type RepositoryStruct struct {
5453
}
5554

5655
type UIStruct struct {
57-
ExplorePagingNum *config.Value[int]
58-
SitemapPagingNum *config.Value[int]
59-
IssuePagingNum *config.Value[int]
60-
RepoSearchPagingNum *config.Value[int]
61-
MembersPagingNum *config.Value[int]
62-
FeedMaxCommitNum *config.Value[int]
63-
FeedPagingNum *config.Value[int]
64-
PackagesPagingNum *config.Value[int]
65-
GraphMaxCommitNum *config.Value[int]
66-
CodeCommentLines *config.Value[int]
67-
ReactionMaxUserNum *config.Value[int]
68-
MaxDisplayFileSize *config.Value[int64]
69-
ShowUserEmail *config.Value[bool]
70-
DefaultShowFullName *config.Value[bool]
71-
DefaultTheme *config.Value[string]
72-
Themes *config.Value[[]string]
73-
SearchRepoDescription *config.Value[bool]
74-
OnlyShowRelevantRepos *config.Value[bool]
75-
ExploreDefaultSort *config.Value[string]
76-
PreferredTimestampTense *config.Value[string]
77-
AmbiguousUnicodeDetection *config.Value[bool]
56+
ExplorePagingNum *config.Value[int]
57+
SitemapPagingNum *config.Value[int]
58+
IssuePagingNum *config.Value[int]
59+
RepoSearchPagingNum *config.Value[int]
60+
MembersPagingNum *config.Value[int]
61+
FeedMaxCommitNum *config.Value[int]
62+
FeedPagingNum *config.Value[int]
63+
PackagesPagingNum *config.Value[int]
64+
GraphMaxCommitNum *config.Value[int]
65+
CodeCommentLines *config.Value[int]
66+
ReactionMaxUserNum *config.Value[int]
67+
ShowUserEmail *config.Value[bool]
68+
DefaultShowFullName *config.Value[bool]
69+
SearchRepoDescription *config.Value[bool]
70+
OnlyShowRelevantRepos *config.Value[bool]
71+
ExploreDefaultSort *config.Value[string]
7872
}
7973

8074
func (u *UIStruct) ToStruct(ctx context.Context) UIForm {
81-
var themes string
82-
for _, v := range u.Themes.Value(ctx) {
83-
themes += v + ","
84-
}
85-
themes = strings.TrimSuffix(themes, ",")
8675
return UIForm{
87-
ExplorePagingNum: u.ExplorePagingNum.Value(ctx),
88-
SitemapPagingNum: u.SitemapPagingNum.Value(ctx),
89-
IssuePagingNum: u.IssuePagingNum.Value(ctx),
90-
RepoSearchPagingNum: u.RepoSearchPagingNum.Value(ctx),
91-
MembersPagingNum: u.MembersPagingNum.Value(ctx),
92-
FeedMaxCommitNum: u.FeedMaxCommitNum.Value(ctx),
93-
FeedPagingNum: u.FeedPagingNum.Value(ctx),
94-
PackagesPagingNum: u.PackagesPagingNum.Value(ctx),
95-
GraphMaxCommitNum: u.GraphMaxCommitNum.Value(ctx),
96-
CodeCommentLines: u.CodeCommentLines.Value(ctx),
97-
ReactionMaxUserNum: u.ReactionMaxUserNum.Value(ctx),
98-
MaxDisplayFileSize: u.MaxDisplayFileSize.Value(ctx),
99-
ShowUserEmail: u.ShowUserEmail.Value(ctx),
100-
DefaultShowFullName: u.DefaultShowFullName.Value(ctx),
101-
DefaultTheme: u.DefaultTheme.Value(ctx),
102-
Themes: themes,
103-
SearchRepoDescription: u.SearchRepoDescription.Value(ctx),
104-
OnlyShowRelevantRepos: u.OnlyShowRelevantRepos.Value(ctx),
105-
ExplorePagingDefaultSort: u.ExploreDefaultSort.Value(ctx),
106-
ExplorePagingSortOption: []string{"recentupdate", "alphabetically", "reverselastlogin", "newest", "oldest"},
107-
PreferredTimestampTense: u.PreferredTimestampTense.Value(ctx),
108-
PreferredTimestampTenseOption: []string{"mixed", "absolute"},
109-
AmbiguousUnicodeDetection: u.AmbiguousUnicodeDetection.Value(ctx),
76+
ExplorePagingNum: u.ExplorePagingNum.Value(ctx),
77+
SitemapPagingNum: u.SitemapPagingNum.Value(ctx),
78+
IssuePagingNum: u.IssuePagingNum.Value(ctx),
79+
RepoSearchPagingNum: u.RepoSearchPagingNum.Value(ctx),
80+
MembersPagingNum: u.MembersPagingNum.Value(ctx),
81+
FeedMaxCommitNum: u.FeedMaxCommitNum.Value(ctx),
82+
FeedPagingNum: u.FeedPagingNum.Value(ctx),
83+
PackagesPagingNum: u.PackagesPagingNum.Value(ctx),
84+
GraphMaxCommitNum: u.GraphMaxCommitNum.Value(ctx),
85+
CodeCommentLines: u.CodeCommentLines.Value(ctx),
86+
ReactionMaxUserNum: u.ReactionMaxUserNum.Value(ctx),
87+
ShowUserEmail: u.ShowUserEmail.Value(ctx),
88+
DefaultShowFullName: u.DefaultShowFullName.Value(ctx),
89+
SearchRepoDescription: u.SearchRepoDescription.Value(ctx),
90+
OnlyShowRelevantRepos: u.OnlyShowRelevantRepos.Value(ctx),
91+
ExplorePagingDefaultSort: u.ExploreDefaultSort.Value(ctx),
92+
ExplorePagingSortOption: []string{"recentupdate", "alphabetically", "reverselastlogin", "newest", "oldest"},
11093
}
11194
}
11295

11396
type UIForm struct {
114-
ExplorePagingNum int
115-
SitemapPagingNum int
116-
IssuePagingNum int
117-
RepoSearchPagingNum int
118-
MembersPagingNum int
119-
FeedMaxCommitNum int
120-
FeedPagingNum int
121-
PackagesPagingNum int
122-
GraphMaxCommitNum int
123-
CodeCommentLines int
124-
ReactionMaxUserNum int
125-
MaxDisplayFileSize int64
126-
ShowUserEmail bool
127-
DefaultShowFullName bool
128-
DefaultTheme string
129-
Themes string
130-
SearchRepoDescription bool
131-
OnlyShowRelevantRepos bool
132-
ExplorePagingDefaultSort string
133-
ExplorePagingSortOption []string
134-
PreferredTimestampTense string
135-
PreferredTimestampTenseOption []string
136-
AmbiguousUnicodeDetection bool
97+
ExplorePagingNum int
98+
SitemapPagingNum int
99+
IssuePagingNum int
100+
RepoSearchPagingNum int
101+
MembersPagingNum int
102+
FeedMaxCommitNum int
103+
FeedPagingNum int
104+
PackagesPagingNum int
105+
GraphMaxCommitNum int
106+
CodeCommentLines int
107+
ReactionMaxUserNum int
108+
ShowUserEmail bool
109+
DefaultShowFullName bool
110+
SearchRepoDescription bool
111+
OnlyShowRelevantRepos bool
112+
ExplorePagingDefaultSort string
113+
ExplorePagingSortOption []string
137114
}
138115

139116
type ConfigStruct struct {
@@ -158,27 +135,22 @@ func initDefaultConfig() {
158135
OpenWithEditorApps: config.ValueJSON[OpenWithEditorAppsType]("repository.open-with.editor-apps"),
159136
},
160137
UI: &UIStruct{
161-
ExplorePagingNum: config.ValueJSON[int]("ui.explore_paging_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "EXPLORE_PAGING_NUM"}).WithDefault(20),
162-
SitemapPagingNum: config.ValueJSON[int]("ui.sitemap_paging_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "SITEMAP_PAGING_NUM"}).WithDefault(20),
163-
IssuePagingNum: config.ValueJSON[int]("ui.issue_paging_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "ISSUE_PAGING_NUM"}).WithDefault(20),
164-
RepoSearchPagingNum: config.ValueJSON[int]("ui.repo_search_paging_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "REPO_SEARCH_PAGING_NUM"}).WithDefault(20),
165-
MembersPagingNum: config.ValueJSON[int]("ui.members_paging_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "MEMBERS_PAGING_NUM"}).WithDefault(20),
166-
FeedMaxCommitNum: config.ValueJSON[int]("ui.feed_max_commit_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "FEED_MAX_COMMIT_NUM"}).WithDefault(20),
167-
FeedPagingNum: config.ValueJSON[int]("ui.feed_paging_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "FEED_PAGE_NUM"}).WithDefault(20),
168-
PackagesPagingNum: config.ValueJSON[int]("ui.packages_paging_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "PACKAGES_PAGING_NUM"}).WithDefault(20),
169-
GraphMaxCommitNum: config.ValueJSON[int]("ui.graph_max_commit_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "GRAPH_MAX_COMMIT_NUM"}).WithDefault(100),
170-
CodeCommentLines: config.ValueJSON[int]("ui.code_comment_lines").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "CODE_COMMENT_LINES"}).WithDefault(4),
171-
ReactionMaxUserNum: config.ValueJSON[int]("ui.reaction_max_user_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "REACTION_MAX_USER_NUM"}).WithDefault(10),
172-
MaxDisplayFileSize: config.ValueJSON[int64]("ui.max_display_file_size").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "MAX_DISPLAY_FILE_SIZE"}).WithDefault(8 * 1024 * 1024),
173-
ShowUserEmail: config.ValueJSON[bool]("ui.show_user_email").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "SHOW_USER_EMAIL"}).WithDefault(true),
174-
DefaultShowFullName: config.ValueJSON[bool]("ui.default_show_full_name").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "DEFAULT_SHOW_FULL_NAME"}).WithDefault(false),
175-
DefaultTheme: config.ValueJSON[string]("ui.default_theme").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "DEFAULT_THEME"}).WithDefault("gitea-auto"),
176-
Themes: config.ValueJSON[[]string]("ui.themes").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "THEMES"}).WithDefault([]string{"gitea-auto", "gitea-dark", "gitea-light"}),
177-
SearchRepoDescription: config.ValueJSON[bool]("ui.search_repo_description").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "SEARCH_REPO_DESCRIPTION"}).WithDefault(false),
178-
OnlyShowRelevantRepos: config.ValueJSON[bool]("ui.only_show_relevant_repos").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "ONLY_SHOW_RELEVANT_REPOS"}).WithDefault(false),
179-
ExploreDefaultSort: config.ValueJSON[string]("ui.explore_paging_default_sort").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "EXPLORE_PAGING_DEFAULT_SORT"}).WithDefault("recentupdate"),
180-
PreferredTimestampTense: config.ValueJSON[string]("ui.preferred_timestamp_tense").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "PREFERRED_TIMESTAMP_TENSE"}).WithDefault("mixed"),
181-
AmbiguousUnicodeDetection: config.ValueJSON[bool]("ui.ambiguous_unicode_detection").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "AMBIGUOUS_UNICODE"}).WithDefault(true),
138+
ExplorePagingNum: config.ValueJSON[int]("ui.explore_paging_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "EXPLORE_PAGING_NUM"}).WithDefault(20),
139+
SitemapPagingNum: config.ValueJSON[int]("ui.sitemap_paging_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "SITEMAP_PAGING_NUM"}).WithDefault(20),
140+
IssuePagingNum: config.ValueJSON[int]("ui.issue_paging_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "ISSUE_PAGING_NUM"}).WithDefault(20),
141+
RepoSearchPagingNum: config.ValueJSON[int]("ui.repo_search_paging_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "REPO_SEARCH_PAGING_NUM"}).WithDefault(20),
142+
MembersPagingNum: config.ValueJSON[int]("ui.members_paging_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "MEMBERS_PAGING_NUM"}).WithDefault(20),
143+
FeedMaxCommitNum: config.ValueJSON[int]("ui.feed_max_commit_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "FEED_MAX_COMMIT_NUM"}).WithDefault(20),
144+
FeedPagingNum: config.ValueJSON[int]("ui.feed_paging_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "FEED_PAGE_NUM"}).WithDefault(20),
145+
PackagesPagingNum: config.ValueJSON[int]("ui.packages_paging_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "PACKAGES_PAGING_NUM"}).WithDefault(20),
146+
GraphMaxCommitNum: config.ValueJSON[int]("ui.graph_max_commit_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "GRAPH_MAX_COMMIT_NUM"}).WithDefault(100),
147+
CodeCommentLines: config.ValueJSON[int]("ui.code_comment_lines").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "CODE_COMMENT_LINES"}).WithDefault(4),
148+
ReactionMaxUserNum: config.ValueJSON[int]("ui.reaction_max_user_num").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "REACTION_MAX_USER_NUM"}).WithDefault(10),
149+
ShowUserEmail: config.ValueJSON[bool]("ui.show_user_email").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "SHOW_USER_EMAIL"}).WithDefault(true),
150+
DefaultShowFullName: config.ValueJSON[bool]("ui.default_show_full_name").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "DEFAULT_SHOW_FULL_NAME"}).WithDefault(false),
151+
SearchRepoDescription: config.ValueJSON[bool]("ui.search_repo_description").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "SEARCH_REPO_DESCRIPTION"}).WithDefault(false),
152+
OnlyShowRelevantRepos: config.ValueJSON[bool]("ui.only_show_relevant_repos").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "ONLY_SHOW_RELEVANT_REPOS"}).WithDefault(false),
153+
ExploreDefaultSort: config.ValueJSON[string]("ui.explore_paging_default_sort").WithFileConfig(config.CfgSecKey{Sec: "ui", Key: "EXPLORE_PAGING_DEFAULT_SORT"}).WithDefault("recentupdate"),
182154
},
183155
}
184156
}

modules/templates/helper.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,13 @@ func evalTokens(tokens ...any) (any, error) {
264264
}
265265

266266
func userThemeName(ctx context.Context, user *user_model.User) string {
267-
if user == nil || user.GetTheme(ctx) == "" {
268-
return setting.Config().UI.DefaultTheme.Value(ctx)
267+
if user == nil || user.Theme == "" {
268+
return setting.UI.DefaultTheme
269269
}
270-
if webtheme.IsThemeAvailable(ctx, user.GetTheme(ctx)) {
271-
return user.GetTheme(ctx)
270+
if webtheme.IsThemeAvailable(ctx, user.Theme) {
271+
return user.Theme
272272
}
273-
return setting.Config().UI.DefaultTheme.Value(ctx)
273+
return setting.UI.DefaultTheme
274274
}
275275

276276
func isQueryParamEmpty(v any) bool {

0 commit comments

Comments
 (0)