loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Refactor `setting.Other` and remove unused `SHOW_FOOTER_BRANDING` (#24270)

The `SHOW_FOOTER_BRANDING` came from year 2015, and it seems nobody ever
uses it. It only shows an GitHub icon which seems unrelated to Gitea, it
doesn't do what document says. So, remove it.

## :warning: Breaking

Users can now remove the key `[other].SHOW_FOOTER_BRANDING` from their
app.ini.

authored by

wxiaoguang and committed by
GitHub
d44e1565 f1173d68

+25 -28
-1
custom/conf/app.example.ini
··· 2340 2340 ;[other] 2341 2341 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2342 2342 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2343 - ;SHOW_FOOTER_BRANDING = false 2344 2343 ;; Show version information about Gitea and Go in the footer 2345 2344 ;SHOW_FOOTER_VERSION = true 2346 2345 ;; Show template execution time in the footer
-1
docs/content/doc/administration/config-cheat-sheet.en-us.md
··· 1391 1391 1392 1392 ## Other (`other`) 1393 1393 1394 - - `SHOW_FOOTER_BRANDING`: **false**: Show Gitea branding in the footer. 1395 1394 - `SHOW_FOOTER_VERSION`: **true**: Show Gitea and Go version information in the footer. 1396 1395 - `SHOW_FOOTER_TEMPLATE_LOAD_TIME`: **true**: Show time of template execution in the footer. 1397 1396 - `ENABLE_SITEMAP`: **true**: Generate sitemap.
-1
docs/content/doc/administration/config-cheat-sheet.zh-cn.md
··· 483 483 484 484 ## Other (`other`) 485 485 486 - - `SHOW_FOOTER_BRANDING`: 为真则在页面底部显示Gitea的字样。 487 486 - `SHOW_FOOTER_VERSION`: 为真则在页面底部显示Gitea的版本。
+1 -2
modules/context/context.go
··· 741 741 742 742 ctx.Data["ShowRegistrationButton"] = setting.Service.ShowRegistrationButton 743 743 ctx.Data["ShowMilestonesDashboardPage"] = setting.Service.ShowMilestonesDashboardPage 744 - ctx.Data["ShowFooterBranding"] = setting.ShowFooterBranding 745 - ctx.Data["ShowFooterVersion"] = setting.ShowFooterVersion 744 + ctx.Data["ShowFooterVersion"] = setting.Other.ShowFooterVersion 746 745 747 746 ctx.Data["EnableSwagger"] = setting.API.EnableSwagger 748 747 ctx.Data["EnableOpenIDSignIn"] = setting.Service.EnableOpenIDSignIn
+2 -2
modules/context/repo.go
··· 452 452 userName := ctx.Params(":username") 453 453 repoName := ctx.Params(":reponame") 454 454 repoName = strings.TrimSuffix(repoName, ".git") 455 - if setting.EnableFeed { 455 + if setting.Other.EnableFeed { 456 456 repoName = strings.TrimSuffix(repoName, ".rss") 457 457 repoName = strings.TrimSuffix(repoName, ".atom") 458 458 } ··· 540 540 ctx.Data["RepoLink"] = ctx.Repo.RepoLink 541 541 ctx.Data["RepoRelPath"] = ctx.Repo.Owner.Name + "/" + ctx.Repo.Repository.Name 542 542 543 - if setting.EnableFeed { 543 + if setting.Other.EnableFeed { 544 544 ctx.Data["EnableFeed"] = true 545 545 ctx.Data["FeedURL"] = ctx.Repo.RepoLink 546 546 }
+14 -9
modules/setting/other.go
··· 3 3 4 4 package setting 5 5 6 - var ( 7 - // Other settings 8 - ShowFooterBranding bool 6 + import "code.gitea.io/gitea/modules/log" 7 + 8 + type OtherConfig struct { 9 9 ShowFooterVersion bool 10 10 ShowFooterTemplateLoadTime bool 11 11 EnableFeed bool 12 12 EnableSitemap bool 13 - ) 13 + } 14 + 15 + var Other = OtherConfig{ 16 + ShowFooterVersion: true, 17 + ShowFooterTemplateLoadTime: true, 18 + EnableSitemap: true, 19 + EnableFeed: true, 20 + } 14 21 15 22 func loadOtherFrom(rootCfg ConfigProvider) { 16 23 sec := rootCfg.Section("other") 17 - ShowFooterBranding = sec.Key("SHOW_FOOTER_BRANDING").MustBool(false) 18 - ShowFooterVersion = sec.Key("SHOW_FOOTER_VERSION").MustBool(true) 19 - ShowFooterTemplateLoadTime = sec.Key("SHOW_FOOTER_TEMPLATE_LOAD_TIME").MustBool(true) 20 - EnableSitemap = sec.Key("ENABLE_SITEMAP").MustBool(true) 21 - EnableFeed = sec.Key("ENABLE_FEED").MustBool(true) 24 + if err := sec.MapTo(&Other); err != nil { 25 + log.Fatal("Failed to map [other] settings: %v", err) 26 + } 22 27 }
+1 -2
modules/templates/base.go
··· 33 33 34 34 "ShowRegistrationButton": setting.Service.ShowRegistrationButton, 35 35 "ShowMilestonesDashboardPage": setting.Service.ShowMilestonesDashboardPage, 36 - "ShowFooterBranding": setting.ShowFooterBranding, 37 - "ShowFooterVersion": setting.ShowFooterVersion, 36 + "ShowFooterVersion": setting.Other.ShowFooterVersion, 38 37 "DisableDownloadSourceArchives": setting.Repository.DisableDownloadSourceArchives, 39 38 40 39 "EnableSwagger": setting.API.EnableSwagger,
+1 -1
modules/templates/helper.go
··· 181 181 return setting.UI.DefaultShowFullName 182 182 }, 183 183 "ShowFooterTemplateLoadTime": func() bool { 184 - return setting.ShowFooterTemplateLoadTime 184 + return setting.Other.ShowFooterTemplateLoadTime 185 185 }, 186 186 "AllowedReactions": func() []string { 187 187 return setting.UI.Reactions
+1 -1
routers/web/repo/view.go
··· 695 695 696 696 // Home render repository home page 697 697 func Home(ctx *context.Context) { 698 - if setting.EnableFeed { 698 + if setting.Other.EnableFeed { 699 699 isFeed, _, showFeedType := feed.GetFeedType(ctx.Params(":reponame"), ctx.Req) 700 700 if isFeed { 701 701 feed.ShowRepoFeed(ctx, ctx.Repo.Repository, showFeedType)
+5 -5
routers/web/web.go
··· 293 293 } 294 294 295 295 sitemapEnabled := func(ctx *context.Context) { 296 - if !setting.EnableSitemap { 296 + if !setting.Other.EnableSitemap { 297 297 ctx.Error(http.StatusNotFound) 298 298 return 299 299 } ··· 307 307 } 308 308 309 309 feedEnabled := func(ctx *context.Context) { 310 - if !setting.EnableFeed { 310 + if !setting.Other.EnableFeed { 311 311 ctx.Error(http.StatusNotFound) 312 312 return 313 313 } ··· 706 706 default: 707 707 context_service.UserAssignmentWeb()(ctx) 708 708 if !ctx.Written() { 709 - ctx.Data["EnableFeed"] = setting.EnableFeed 709 + ctx.Data["EnableFeed"] = setting.Other.EnableFeed 710 710 user.Profile(ctx) 711 711 } 712 712 } ··· 1205 1205 m.Get(".rss", feedEnabled, repo.TagsListFeedRSS) 1206 1206 m.Get(".atom", feedEnabled, repo.TagsListFeedAtom) 1207 1207 }, func(ctx *context.Context) { 1208 - ctx.Data["EnableFeed"] = setting.EnableFeed 1208 + ctx.Data["EnableFeed"] = setting.Other.EnableFeed 1209 1209 }, repo.MustBeNotEmpty, reqRepoCodeReader, context.RepoRefByType(context.RepoRefTag, true)) 1210 1210 m.Group("/releases", func() { 1211 1211 m.Get("/", repo.Releases) ··· 1214 1214 m.Get(".rss", feedEnabled, repo.ReleasesFeedRSS) 1215 1215 m.Get(".atom", feedEnabled, repo.ReleasesFeedAtom) 1216 1216 }, func(ctx *context.Context) { 1217 - ctx.Data["EnableFeed"] = setting.EnableFeed 1217 + ctx.Data["EnableFeed"] = setting.Other.EnableFeed 1218 1218 }, repo.MustBeNotEmpty, reqRepoReleaseReader, context.RepoRefByType(context.RepoRefTag, true)) 1219 1219 m.Get("/releases/attachments/{uuid}", repo.GetAttachment, repo.MustBeNotEmpty, reqRepoReleaseReader) 1220 1220 m.Group("/releases", func() {
-3
templates/base/footer_content.tmpl
··· 15 15 {{end}} 16 16 </div> 17 17 <div class="ui right links" role="group" aria-label="{{.locale.Tr "aria.footer.links"}}"> 18 - {{if .ShowFooterBranding}} 19 - <a target="_blank" rel="noopener noreferrer" href="https://github.com/go-gitea/gitea">{{svg "octicon-mark-github"}}<span class="sr-only">GitHub</span></a> 20 - {{end}} 21 18 <div class="ui dropdown upward language"> 22 19 <span>{{svg "octicon-globe"}} {{.locale.LangName}}</span> 23 20 <div class="menu language-menu">