mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-30 17:25:51 +02:00
remove duplicated code
This commit is contained in:
parent
2d644fb4ce
commit
bb82979191
@ -46,18 +46,7 @@ func RefBlame(ctx *context.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
showFileViewTreeSidebar := true
|
prepareHomeTreeSideBarSwitch(ctx)
|
||||||
if ctx.Doer != nil {
|
|
||||||
v, err := user_model.GetUserSetting(ctx, ctx.Doer.ID, user_model.SettingsKeyShowFileViewTreeSidebar, "true")
|
|
||||||
if err != nil {
|
|
||||||
log.Error("GetUserSetting: %v", err)
|
|
||||||
} else {
|
|
||||||
showFileViewTreeSidebar, _ = strconv.ParseBool(v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ctx.Data["RepoPreferences"] = &preferencesForm{
|
|
||||||
ShowFileViewTreeSidebar: showFileViewTreeSidebar,
|
|
||||||
}
|
|
||||||
|
|
||||||
branchLink := ctx.Repo.RepoLink + "/src/" + ctx.Repo.RefTypeNameSubURL()
|
branchLink := ctx.Repo.RepoLink + "/src/" + ctx.Repo.RefTypeNameSubURL()
|
||||||
treeLink := branchLink
|
treeLink := branchLink
|
||||||
|
@ -312,6 +312,21 @@ func handleRepoHomeFeed(ctx *context.Context) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func prepareHomeTreeSideBarSwitch(ctx *context.Context) {
|
||||||
|
showFileViewTreeSidebar := true
|
||||||
|
if ctx.Doer != nil {
|
||||||
|
v, err := user_model.GetUserSetting(ctx, ctx.Doer.ID, user_model.SettingsKeyShowFileViewTreeSidebar, "true")
|
||||||
|
if err != nil {
|
||||||
|
log.Error("GetUserSetting: %v", err)
|
||||||
|
} else {
|
||||||
|
showFileViewTreeSidebar, _ = strconv.ParseBool(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctx.Data["RepoPreferences"] = &preferencesForm{
|
||||||
|
ShowFileViewTreeSidebar: showFileViewTreeSidebar,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Home render repository home page
|
// Home render repository home page
|
||||||
func Home(ctx *context.Context) {
|
func Home(ctx *context.Context) {
|
||||||
if handleRepoHomeFeed(ctx) {
|
if handleRepoHomeFeed(ctx) {
|
||||||
@ -325,18 +340,7 @@ func Home(ctx *context.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
showFileViewTreeSidebar := true
|
prepareHomeTreeSideBarSwitch(ctx)
|
||||||
if ctx.Doer != nil {
|
|
||||||
v, err := user_model.GetUserSetting(ctx, ctx.Doer.ID, user_model.SettingsKeyShowFileViewTreeSidebar, "true")
|
|
||||||
if err != nil {
|
|
||||||
log.Error("GetUserSetting: %v", err)
|
|
||||||
} else {
|
|
||||||
showFileViewTreeSidebar, _ = strconv.ParseBool(v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ctx.Data["RepoPreferences"] = &preferencesForm{
|
|
||||||
ShowFileViewTreeSidebar: showFileViewTreeSidebar,
|
|
||||||
}
|
|
||||||
|
|
||||||
title := ctx.Repo.Repository.Owner.Name + "/" + ctx.Repo.Repository.Name
|
title := ctx.Repo.Repository.Owner.Name + "/" + ctx.Repo.Repository.Name
|
||||||
if len(ctx.Repo.Repository.Description) > 0 {
|
if len(ctx.Repo.Repository.Description) > 0 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user