@@ -5,6 +5,7 @@ package setting
55
66import (
77 "context"
8+ "strings"
89 "sync"
910
1011 "code.gitea.io/gitea/modules/container"
@@ -82,6 +83,19 @@ type UIStruct struct {
8283}
8384
8485func (u * UIStruct ) ToStruct (ctx context.Context ) UIForm {
86+ var themes , reactions , customEmojis string
87+ for _ , v := range u .Themes .Value (ctx ) {
88+ themes += v + ","
89+ }
90+ themes = strings .TrimSuffix (themes , "," )
91+ for _ , v := range u .Reactions .Value (ctx ) {
92+ reactions += v + ","
93+ }
94+ reactions = strings .TrimSuffix (reactions , "," )
95+ for _ , v := range u .CustomEmojis .Value (ctx ) {
96+ customEmojis += v + ","
97+ }
98+ customEmojis = strings .TrimSuffix (customEmojis , "," )
8599 return UIForm {
86100 ExplorePagingNum : u .ExplorePagingNum .Value (ctx ),
87101 SitemapPagingNum : u .SitemapPagingNum .Value (ctx ),
@@ -98,12 +112,12 @@ func (u *UIStruct) ToStruct(ctx context.Context) UIForm {
98112 ShowUserEmail : u .ShowUserEmail .Value (ctx ),
99113 DefaultShowFullName : u .DefaultShowFullName .Value (ctx ),
100114 DefaultTheme : u .DefaultTheme .Value (ctx ),
101- Themes : u . Themes . Value ( ctx ) ,
102- Reactions : u . Reactions . Value ( ctx ) ,
103- CustomEmojis : u . CustomEmojis . Value ( ctx ) ,
115+ Themes : themes ,
116+ Reactions : reactions ,
117+ CustomEmojis : customEmojis ,
104118 SearchRepoDescription : u .SearchRepoDescription .Value (ctx ),
105119 OnlyShowRelevantRepos : u .OnlyShowRelevantRepos .Value (ctx ),
106- ExploreDefaultSort : u .ExploreDefaultSort .Value (ctx ),
120+ ExplorePagingDefaultSort : u .ExploreDefaultSort .Value (ctx ),
107121 PreferredTimestampTense : u .PreferredTimestampTense .Value (ctx ),
108122 AmbiguousUnicodeDetection : u .AmbiguousUnicodeDetection .Value (ctx ),
109123 }
@@ -125,12 +139,12 @@ type UIForm struct {
125139 ShowUserEmail bool
126140 DefaultShowFullName bool
127141 DefaultTheme string
128- Themes [] string
129- Reactions [] string
130- CustomEmojis [] string
142+ Themes string
143+ Reactions string
144+ CustomEmojis string
131145 SearchRepoDescription bool
132146 OnlyShowRelevantRepos bool
133- ExploreDefaultSort string
147+ ExplorePagingDefaultSort string
134148 PreferredTimestampTense string
135149 AmbiguousUnicodeDetection bool
136150}
@@ -177,7 +191,7 @@ func initDefaultConfig() {
177191 CustomEmojis : config.ValueJSON [[]string ]("ui.custom_emojis" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "CUSTOM_EMOJIS" }),
178192 SearchRepoDescription : config.ValueJSON [bool ]("ui.search_repo_description" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "SEARCH_REPO_DESCRIPTION" }),
179193 OnlyShowRelevantRepos : config.ValueJSON [bool ]("ui.only_show_relevant_repos" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "ONLY_SHOW_RELEVANT_REPOS" }),
180- ExploreDefaultSort : config.ValueJSON [string ]("ui.explore_default_sort " ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "EXPLORE_PAGING_DEFAULT_SORT" }),
194+ ExploreDefaultSort : config.ValueJSON [string ]("ui.explore_paging_default_sort " ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "EXPLORE_PAGING_DEFAULT_SORT" }),
181195 PreferredTimestampTense : config.ValueJSON [string ]("ui.preferred_timestamp_tense" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "PREFERRED_TIMESTAMP_TENSE" }),
182196 AmbiguousUnicodeDetection : config.ValueJSON [bool ]("ui.ambiguous_unicode_detection" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "AMBIGUOUS_UNICODE" }),
183197 },
0 commit comments