@@ -312,6 +312,21 @@ func handleRepoHomeFeed(ctx *context.Context) bool {
312312 return false
313313}
314314
315+ func prepareHomeTreeSideBarSwitch (ctx * context.Context ) {
316+ showFileViewTreeSidebar := true
317+ if ctx .Doer != nil {
318+ v , err := user_model .GetUserSetting (ctx , ctx .Doer .ID , user_model .SettingsKeyShowFileViewTreeSidebar , "true" )
319+ if err != nil {
320+ log .Error ("GetUserSetting: %v" , err )
321+ } else {
322+ showFileViewTreeSidebar , _ = strconv .ParseBool (v )
323+ }
324+ }
325+ ctx .Data ["RepoPreferences" ] = & preferencesForm {
326+ ShowFileViewTreeSidebar : showFileViewTreeSidebar ,
327+ }
328+ }
329+
315330// Home render repository home page
316331func Home (ctx * context.Context ) {
317332 if handleRepoHomeFeed (ctx ) {
@@ -325,18 +340,7 @@ func Home(ctx *context.Context) {
325340 return
326341 }
327342
328- showFileViewTreeSidebar := true
329- if ctx .Doer != nil {
330- v , err := user_model .GetUserSetting (ctx , ctx .Doer .ID , user_model .SettingsKeyShowFileViewTreeSidebar , "true" )
331- if err != nil {
332- log .Error ("GetUserSetting: %v" , err )
333- } else {
334- showFileViewTreeSidebar , _ = strconv .ParseBool (v )
335- }
336- }
337- ctx .Data ["RepoPreferences" ] = & preferencesForm {
338- ShowFileViewTreeSidebar : showFileViewTreeSidebar ,
339- }
343+ prepareHomeTreeSideBarSwitch (ctx )
340344
341345 title := ctx .Repo .Repository .Owner .Name + "/" + ctx .Repo .Repository .Name
342346 if len (ctx .Repo .Repository .Description ) > 0 {
0 commit comments