From 2e43a6a2478e59ab14cd8b9770b0f697284bdabd Mon Sep 17 00:00:00 2001 From: Julian Picht Date: Thu, 23 May 2019 15:40:35 +0200 Subject: [PATCH 01/10] Implement ENABLE_WIKI config option Signed-off-by: Julian Picht --- custom/conf/app.ini.sample | 2 ++ models/repo.go | 4 +++ modules/setting/service.go | 6 ++++ options/locale/locale_en-US.ini | 1 + routers/repo/setting.go | 2 +- routers/repo/wiki.go | 5 +++ templates/repo/header.tmpl | 2 +- templates/repo/settings/options.tmpl | 50 ++++++++++++++++------------ 8 files changed, 48 insertions(+), 24 deletions(-) diff --git a/custom/conf/app.ini.sample b/custom/conf/app.ini.sample index 991a2a3e6b4b..75cccfcf5f1f 100644 --- a/custom/conf/app.ini.sample +++ b/custom/conf/app.ini.sample @@ -424,6 +424,8 @@ SHOW_REGISTRATION_BUTTON = true ; When adding a repo to a team or creating a new repo all team members will watch the ; repo automatically if enabled AUTO_WATCH_NEW_REPOS = true +; Set this to false to completely disable the wiki function +ENABLE_WIKI = true [webhook] ; Hook task queue length, increase if webhook shooting starts hanging diff --git a/models/repo.go b/models/repo.go index 86370821d3bb..aada6a7b1918 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1287,6 +1287,10 @@ func createRepository(e *xorm.Session, doer, u *User, repo *Repository) (err err EnableDependencies: setting.Service.DefaultEnableDependencies, }, }) + } else if tp == UnitTypeWiki { + if !setting.Service.EnableWiki { + continue + } } else if tp == UnitTypePullRequests { units = append(units, RepoUnit{ RepoID: repo.ID, diff --git a/modules/setting/service.go b/modules/setting/service.go index 97babc5aaf21..584de05e623d 100644 --- a/modules/setting/service.go +++ b/modules/setting/service.go @@ -48,6 +48,9 @@ var Service struct { EnableOpenIDSignUp bool OpenIDWhitelist []*regexp.Regexp OpenIDBlacklist []*regexp.Regexp + + // global feature flags + EnableWiki bool } func newService() { @@ -83,6 +86,9 @@ func newService() { Service.DefaultOrgVisibility = sec.Key("DEFAULT_ORG_VISIBILITY").In("public", structs.ExtractKeysFromMapString(structs.VisibilityModes)) Service.DefaultOrgVisibilityMode = structs.VisibilityModes[Service.DefaultOrgVisibility] + // feature flags + Service.EnableWiki = sec.Key("ENABLE_WIKI").MustBool(true) + sec = Cfg.Section("openid") Service.EnableOpenIDSignIn = sec.Key("ENABLE_OPENID_SIGNIN").MustBool(!InstallLock) Service.EnableOpenIDSignUp = sec.Key("ENABLE_OPENID_SIGNUP").MustBool(!Service.DisableRegistration && Service.EnableOpenIDSignIn) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 0df7cdf7e0d0..66b2079ba75e 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1044,6 +1044,7 @@ wiki.page_already_exists = A wiki page with the same name already exists. wiki.reserved_page = The wiki page name '%s' is reserved. wiki.pages = Pages wiki.last_updated = Last updated %s +wiki.disabled = The wiki function has been disabled for this installation. activity = Activity activity.period.filter_label = Period: diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 757295069e90..4bccaa2d3d50 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -218,7 +218,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) { }) } - if form.EnableWiki { + if form.EnableWiki && setting.Service.EnableWiki { if form.EnableExternalWiki { if !validation.IsValidExternalURL(form.ExternalWikiURL) { ctx.Flash.Error(ctx.Tr("repo.settings.external_wiki_url_error")) diff --git a/routers/repo/wiki.go b/routers/repo/wiki.go index 0d965f218393..d8ea86a62684 100644 --- a/routers/repo/wiki.go +++ b/routers/repo/wiki.go @@ -19,6 +19,7 @@ import ( "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/markup" "code.gitea.io/gitea/modules/markup/markdown" + "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/util" ) @@ -32,6 +33,10 @@ const ( // MustEnableWiki check if wiki is enabled, if external then redirect func MustEnableWiki(ctx *context.Context) { + if !setting.Service.EnableWiki { + ctx.NotFound("MustEnableWiki", nil) + return + } if !ctx.Repo.CanRead(models.UnitTypeWiki) && !ctx.Repo.CanRead(models.UnitTypeExternalWiki) { if log.IsTrace() { diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index f264a9b55956..8d15221f6eec 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -79,7 +79,7 @@ {{end}} - {{if or (.Permission.CanRead $.UnitTypeWiki) (.Permission.CanRead $.UnitTypeExternalWiki)}} + {{if and .Service.EnableWiki (or (.Permission.CanRead $.UnitTypeWiki) (.Permission.CanRead $.UnitTypeExternalWiki))}} {{.i18n.Tr "repo.wiki"}} diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index c6d715acbee8..efaeee0abdc9 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -113,33 +113,39 @@ {{.CsrfTokenHtml}} - {{$isWikiEnabled := or (.Repository.UnitEnabled $.UnitTypeWiki) (.Repository.UnitEnabled $.UnitTypeExternalWiki)}} -
- -
- - -
-
-
-
-
- - + {{if .Service.EnableWiki}} + {{$isWikiEnabled := or (.Repository.UnitEnabled $.UnitTypeWiki) (.Repository.UnitEnabled $.UnitTypeExternalWiki)}} +
+ +
+ +
-
-
- - +
+
+
+ + +
+
+
+
+ + +
+
+
+ + +

{{.i18n.Tr "repo.settings.external_wiki_url_desc"}}

-
- - -

{{.i18n.Tr "repo.settings.external_wiki_url_desc"}}

+ {{else}} +
+
-
+ {{end}}
From 7d753f902d7a121a136a984c522604d1999b043d Mon Sep 17 00:00:00 2001 From: Julian Picht Date: Thu, 23 May 2019 15:41:21 +0200 Subject: [PATCH 02/10] Implement ENABLE_ISSUES config option Signed-off-by: Julian Picht --- custom/conf/app.ini.sample | 2 + models/repo.go | 3 + modules/setting/service.go | 4 +- options/locale/locale_en-US.ini | 1 + routers/api/v1/api.go | 4 +- routers/repo/activity.go | 3 +- routers/repo/issue.go | 9 +- routers/repo/issue_label_test.go | 3 + routers/repo/setting.go | 2 +- routers/routes/routes.go | 4 +- routers/user/home.go | 2 +- templates/base/head_navbar.tmpl | 4 +- templates/repo/header.tmpl | 4 +- templates/repo/settings/options.tmpl | 122 ++++++++++++++------------- 14 files changed, 94 insertions(+), 73 deletions(-) diff --git a/custom/conf/app.ini.sample b/custom/conf/app.ini.sample index 75cccfcf5f1f..4409431dbcb0 100644 --- a/custom/conf/app.ini.sample +++ b/custom/conf/app.ini.sample @@ -426,6 +426,8 @@ SHOW_REGISTRATION_BUTTON = true AUTO_WATCH_NEW_REPOS = true ; Set this to false to completely disable the wiki function ENABLE_WIKI = true +; Set this to false to completely disable the issue function +ENABLE_ISSUES = true [webhook] ; Hook task queue length, increase if webhook shooting starts hanging diff --git a/models/repo.go b/models/repo.go index aada6a7b1918..e84ffb225de6 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1278,6 +1278,9 @@ func createRepository(e *xorm.Session, doer, u *User, repo *Repository) (err err var units = make([]RepoUnit, 0, len(DefaultRepoUnits)) for _, tp := range DefaultRepoUnits { if tp == UnitTypeIssues { + if !setting.Service.EnableIssues { + continue + } units = append(units, RepoUnit{ RepoID: repo.ID, Type: tp, diff --git a/modules/setting/service.go b/modules/setting/service.go index 584de05e623d..2147eaedcf82 100644 --- a/modules/setting/service.go +++ b/modules/setting/service.go @@ -50,7 +50,8 @@ var Service struct { OpenIDBlacklist []*regexp.Regexp // global feature flags - EnableWiki bool + EnableWiki bool + EnableIssues bool } func newService() { @@ -87,6 +88,7 @@ func newService() { Service.DefaultOrgVisibilityMode = structs.VisibilityModes[Service.DefaultOrgVisibility] // feature flags + Service.EnableIssues = sec.Key("ENABLE_ISSUES").MustBool(true) Service.EnableWiki = sec.Key("ENABLE_WIKI").MustBool(true) sec = Cfg.Section("openid") diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 66b2079ba75e..b34af85797a7 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -945,6 +945,7 @@ issues.review.review = Review issues.review.reviewers = Reviewers issues.review.show_outdated = Show outdated issues.review.hide_outdated = Hide outdated +issues.disabled = Issues are disabled for this installation. pulls.desc = Enable merge requests and code reviews. pulls.new = New Pull Request diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index cd308fce5182..9a81d2555624 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -408,7 +408,7 @@ func orgAssignment(args ...bool) macaron.Handler { } func mustEnableIssues(ctx *context.APIContext) { - if !ctx.Repo.CanRead(models.UnitTypeIssues) { + if !setting.Service.EnableIssues || !ctx.Repo.CanRead(models.UnitTypeIssues) { if log.IsTrace() { if ctx.IsSigned { log.Trace("Permission Denied: User %-v cannot read %-v in Repo %-v\n"+ @@ -454,7 +454,7 @@ func mustAllowPulls(ctx *context.APIContext) { } func mustEnableIssuesOrPulls(ctx *context.APIContext) { - if !ctx.Repo.CanRead(models.UnitTypeIssues) && + if (!setting.Service.EnableIssues || !ctx.Repo.CanRead(models.UnitTypeIssues)) && !(ctx.Repo.Repository.CanEnablePulls() && ctx.Repo.CanRead(models.UnitTypePullRequests)) { if ctx.Repo.Repository.CanEnablePulls() && log.IsTrace() { if ctx.IsSigned { diff --git a/routers/repo/activity.go b/routers/repo/activity.go index e170a9129991..6581529cc8a7 100644 --- a/routers/repo/activity.go +++ b/routers/repo/activity.go @@ -10,6 +10,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" + "code.gitea.io/gitea/modules/setting" ) const ( @@ -46,7 +47,7 @@ func Activity(ctx *context.Context) { var err error if ctx.Data["Activity"], err = models.GetActivityStats(ctx.Repo.Repository, timeFrom, ctx.Repo.CanRead(models.UnitTypeReleases), - ctx.Repo.CanRead(models.UnitTypeIssues), + setting.Service.EnableIssues && ctx.Repo.CanRead(models.UnitTypeIssues), ctx.Repo.CanRead(models.UnitTypePullRequests), ctx.Repo.CanRead(models.UnitTypeCode)); err != nil { ctx.ServerError("GetActivityStats", err) diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 72e0357e6cf8..703f9306783b 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -73,8 +73,9 @@ func MustAllowUserComment(ctx *context.Context) { // MustEnableIssues check if repository enable internal issues func MustEnableIssues(ctx *context.Context) { - if !ctx.Repo.CanRead(models.UnitTypeIssues) && - !ctx.Repo.CanRead(models.UnitTypeExternalTracker) { + if !setting.Service.EnableIssues || + (!ctx.Repo.CanRead(models.UnitTypeIssues) && + !ctx.Repo.CanRead(models.UnitTypeExternalTracker)) { ctx.NotFound("MustEnableIssues", nil) return } @@ -987,7 +988,7 @@ func GetActionIssue(ctx *context.Context) *models.Issue { func checkIssueRights(ctx *context.Context, issue *models.Issue) { if issue.IsPull && !ctx.Repo.CanRead(models.UnitTypePullRequests) || - !issue.IsPull && !ctx.Repo.CanRead(models.UnitTypeIssues) { + !issue.IsPull && (!setting.Service.EnableIssues || !ctx.Repo.CanRead(models.UnitTypeIssues)) { ctx.NotFound("IssueOrPullRequestUnitNotAllowed", nil) } } @@ -1012,7 +1013,7 @@ func getActionIssues(ctx *context.Context) []*models.Issue { return nil } // Check access rights for all issues - issueUnitEnabled := ctx.Repo.CanRead(models.UnitTypeIssues) + issueUnitEnabled := setting.Service.EnableIssues && ctx.Repo.CanRead(models.UnitTypeIssues) prUnitEnabled := ctx.Repo.CanRead(models.UnitTypePullRequests) for _, issue := range issues { if issue.IsPull && !prUnitEnabled || !issue.IsPull && !issueUnitEnabled { diff --git a/routers/repo/issue_label_test.go b/routers/repo/issue_label_test.go index bf625112581e..dfe6194eb735 100644 --- a/routers/repo/issue_label_test.go +++ b/routers/repo/issue_label_test.go @@ -11,6 +11,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/auth" + "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/test" "github.com/stretchr/testify/assert" @@ -119,6 +120,7 @@ func TestDeleteLabel(t *testing.T) { } func TestUpdateIssueLabel_Clear(t *testing.T) { + setting.Service.EnableIssues = true models.PrepareTestEnv(t) ctx := test.MockContext(t, "user2/repo1/issues/labels") test.LoadUser(t, ctx, 2) @@ -133,6 +135,7 @@ func TestUpdateIssueLabel_Clear(t *testing.T) { } func TestUpdateIssueLabel_Toggle(t *testing.T) { + setting.Service.EnableIssues = true for _, testCase := range []struct { Action string IssueIDs []int64 diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 4bccaa2d3d50..af6cc7643439 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -242,7 +242,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) { } } - if form.EnableIssues { + if form.EnableIssues && setting.Service.EnableIssues { if form.EnableExternalTracker { if !validation.IsValidExternalURL(form.ExternalTrackerURL) { ctx.Flash.Error(ctx.Tr("repo.settings.external_tracker_url_error")) diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 6169aa563c09..0b9e20a3e653 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -677,7 +677,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Group("/:username/:reponame", func() { m.Group("/issues", func() { m.Combo("/new").Get(context.RepoRef(), repo.NewIssue). - Post(bindIgnErr(auth.CreateIssueForm{}), repo.NewIssuePost) + Post(bindIgnErr(auth.CreateIssueForm{}), repo.NewIssuePost, repo.MustEnableIssues) }, context.RepoMustNotBeArchived(), reqRepoIssueReader) // FIXME: should use different URLs but mostly same logic for comments of issue and pull reuqest. // So they can apply their own enable/disable logic on routers. @@ -707,7 +707,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Post("/milestone", reqRepoIssuesOrPullsWriter, repo.UpdateIssueMilestone) m.Post("/assignee", reqRepoIssuesOrPullsWriter, repo.UpdateIssueAssignee) m.Post("/status", reqRepoIssuesOrPullsWriter, repo.UpdateIssueStatus) - }, context.RepoMustNotBeArchived()) + }, context.RepoMustNotBeArchived(), repo.MustEnableIssues) m.Group("/comments/:id", func() { m.Post("", repo.UpdateCommentContent) m.Post("/delete", repo.DeleteComment) diff --git a/routers/user/home.go b/routers/user/home.go index 9ccd5bdb2681..2f2e58d7827d 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -308,7 +308,7 @@ func Issues(ctx *context.Context) { ctx.ServerError("GetUserRepoPermission", fmt.Errorf("[%d]%v", repoID, err)) return } - if !perm.CanRead(models.UnitTypeIssues) { + if !setting.Service.EnableIssues || !perm.CanRead(models.UnitTypeIssues) { if log.IsTrace() { log.Trace("Permission Denied: User %-v cannot read %-v of repo %-v\n"+ "User in repo has Permissions: %-+v", diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index 30316e7e5b07..5044cd30e6e6 100644 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -10,7 +10,9 @@ {{if .IsSigned}} {{.i18n.Tr "dashboard"}} - {{.i18n.Tr "issues"}} + {{if .Service.EnableIssues}} + {{.i18n.Tr "issues"}} + {{end}} {{.i18n.Tr "pull_requests"}} {{.i18n.Tr "explore"}} {{else if .IsLandingPageHome}} diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 8d15221f6eec..8adb264a6fac 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -55,13 +55,13 @@ {{end}} - {{if .Permission.CanRead $.UnitTypeIssues}} + {{if and .Service.EnableIssues (.Permission.CanRead $.UnitTypeIssues)}} {{.i18n.Tr "repo.issues"}} {{.Repository.NumOpenIssues}} {{end}} - {{if .Permission.CanRead $.UnitTypeExternalTracker}} + {{if and .Service.EnableIssues (.Permission.CanRead $.UnitTypeExternalTracker)}} {{.i18n.Tr "repo.issues"}} diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index efaeee0abdc9..ca9d1f3643c6 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -149,79 +149,85 @@
- {{$isIssuesEnabled := or (.Repository.UnitEnabled $.UnitTypeIssues) (.Repository.UnitEnabled $.UnitTypeExternalTracker)}} -
- -
- - -
-
-
-
-
- - + {{if .Service.EnableIssues}} + {{$isIssuesEnabled := or (.Repository.UnitEnabled $.UnitTypeIssues) (.Repository.UnitEnabled $.UnitTypeExternalTracker)}} +
+ +
+ +
-
- {{if .Repository.CanEnableTimetracker}} -
-
- - -
+
+
+
+ +
-
-
- - +
+
+ {{if .Repository.CanEnableTimetracker}} +
+
+ + +
-
- {{end}} -
-
- - +
+
+ + +
+
+ {{end}} +
+
+ + +
-
-
-
-
- - -
-
-
-
- - -

{{.i18n.Tr "repo.settings.external_tracker_url_desc"}}

- - -

{{.i18n.Tr "repo.settings.tracker_url_format_desc" | Str2html}}

+
+ + +
-
- +
-
- {{$externalTracker := (.Repository.MustGetUnit $.UnitTypeExternalTracker)}} - {{$externalTrackerStyle := $externalTracker.ExternalTrackerConfig.ExternalTrackerStyle}} - - -
+ + +

{{.i18n.Tr "repo.settings.external_tracker_url_desc"}}

-
- - + + +

{{.i18n.Tr "repo.settings.tracker_url_format_desc" | Str2html}}

+
+
+ +
+
+ {{$externalTracker := (.Repository.MustGetUnit $.UnitTypeExternalTracker)}} + {{$externalTrackerStyle := $externalTracker.ExternalTrackerConfig.ExternalTrackerStyle}} + + +
+
+
+
+ + +
-
+ {{else}} +
+ +
+ {{end}} {{if .Repository.CanEnablePulls}}
From f14272edb0c37d2a6341c684dc879e600eab8a3f Mon Sep 17 00:00:00 2001 From: Julian Picht Date: Thu, 23 May 2019 15:41:32 +0200 Subject: [PATCH 03/10] Clean up the repo settings page, if both issues and wiki are disabled Signed-off-by: Julian Picht --- templates/repo/settings/options.tmpl | 283 ++++++++++++++------------- 1 file changed, 146 insertions(+), 137 deletions(-) diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index ca9d1f3643c6..7e320c405a26 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -109,176 +109,185 @@ {{.i18n.Tr "repo.settings.advanced_settings"}}
-
- {{.CsrfTokenHtml}} - + {{if and (not .Service.EnableWiki) (not .Service.EnableIssues)}} +
+ +
+
+ +
+ {{else}} + + {{.CsrfTokenHtml}} + - {{if .Service.EnableWiki}} - {{$isWikiEnabled := or (.Repository.UnitEnabled $.UnitTypeWiki) (.Repository.UnitEnabled $.UnitTypeExternalWiki)}} -
- -
- - -
-
-
-
-
- - + {{if .Service.EnableWiki}} + {{$isWikiEnabled := or (.Repository.UnitEnabled $.UnitTypeWiki) (.Repository.UnitEnabled $.UnitTypeExternalWiki)}} +
+ +
+ +
-
-
- - +
+
+
+ + +
+
+
+
+ + +
+
+
+ + +

{{.i18n.Tr "repo.settings.external_wiki_url_desc"}}

-
- - -

{{.i18n.Tr "repo.settings.external_wiki_url_desc"}}

+ {{else}} +
+
-
- {{else}} -
- -
- {{end}} + {{end}} -
+
- {{if .Service.EnableIssues}} - {{$isIssuesEnabled := or (.Repository.UnitEnabled $.UnitTypeIssues) (.Repository.UnitEnabled $.UnitTypeExternalTracker)}} -
- -
- - -
-
-
-
-
- - + {{if .Service.EnableIssues}} + {{$isIssuesEnabled := or (.Repository.UnitEnabled $.UnitTypeIssues) (.Repository.UnitEnabled $.UnitTypeExternalTracker)}} +
+ +
+ +
-
- {{if .Repository.CanEnableTimetracker}} -
-
- - -
+
+
+
+ +
-
-
- - +
+
+ {{if .Repository.CanEnableTimetracker}} +
+
+ + +
-
- {{end}} -
-
- - +
+
+ + +
+
+ {{end}} +
+
+ + +
-
-
-
-
- - -
-
-
-
- - -

{{.i18n.Tr "repo.settings.external_tracker_url_desc"}}

- - -

{{.i18n.Tr "repo.settings.tracker_url_format_desc" | Str2html}}

+
+ + +
-
- +
-
- {{$externalTracker := (.Repository.MustGetUnit $.UnitTypeExternalTracker)}} - {{$externalTrackerStyle := $externalTracker.ExternalTrackerConfig.ExternalTrackerStyle}} - - -
+ + +

{{.i18n.Tr "repo.settings.external_tracker_url_desc"}}

-
- - + + +

{{.i18n.Tr "repo.settings.tracker_url_format_desc" | Str2html}}

+
+
+ +
+
+ {{$externalTracker := (.Repository.MustGetUnit $.UnitTypeExternalTracker)}} + {{$externalTrackerStyle := $externalTracker.ExternalTrackerConfig.ExternalTrackerStyle}} + + +
+
+
+
+ + +
-
- {{else}} -
- -
- {{end}} - - {{if .Repository.CanEnablePulls}} -
- {{$pullRequestEnabled := .Repository.UnitEnabled $.UnitTypePullRequests}} - {{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}} -
- -
- - + {{else}} +
+
-
-
-
+ {{end}} + + {{if .Repository.CanEnablePulls}} +
+ {{$pullRequestEnabled := .Repository.UnitEnabled $.UnitTypePullRequests}} + {{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}} +
+
- - + +
-
-
- - +
+
+
+ + +
-
-
-
- - +
+
+ + +
-
-
-
- - +
+
+ + +
-
-
-
- - +
+
+ + +
+
+
+
+ + +
-
- {{end}} + {{end}} -
-
- -
- +
+
+ +
+ + {{end}}
{{if .IsAdmin}} From 033d7e17f7e4d2243aeb511ac589cabe75792ca7 Mon Sep 17 00:00:00 2001 From: Julian Picht Date: Thu, 11 Jul 2019 14:55:17 +0200 Subject: [PATCH 04/10] remove unneccessary changes Signed-off-by: Julian Picht --- routers/api/v1/api.go | 2 +- routers/repo/issue_label_test.go | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 9a81d2555624..da54f8accb19 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -408,7 +408,7 @@ func orgAssignment(args ...bool) macaron.Handler { } func mustEnableIssues(ctx *context.APIContext) { - if !setting.Service.EnableIssues || !ctx.Repo.CanRead(models.UnitTypeIssues) { + if !ctx.Repo.CanRead(models.UnitTypeIssues) { if log.IsTrace() { if ctx.IsSigned { log.Trace("Permission Denied: User %-v cannot read %-v in Repo %-v\n"+ diff --git a/routers/repo/issue_label_test.go b/routers/repo/issue_label_test.go index dfe6194eb735..ae4a2c2a3e07 100644 --- a/routers/repo/issue_label_test.go +++ b/routers/repo/issue_label_test.go @@ -120,7 +120,6 @@ func TestDeleteLabel(t *testing.T) { } func TestUpdateIssueLabel_Clear(t *testing.T) { - setting.Service.EnableIssues = true models.PrepareTestEnv(t) ctx := test.MockContext(t, "user2/repo1/issues/labels") test.LoadUser(t, ctx, 2) From 061316c66025a246d001a351f2b960619f4e4a9b Mon Sep 17 00:00:00 2001 From: Julian Picht Date: Thu, 11 Jul 2019 15:05:12 +0200 Subject: [PATCH 05/10] set EnableIssues = true for TestUpdateIssueLabel_Clear Signed-off-by: Julian Picht --- routers/repo/issue_label_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/routers/repo/issue_label_test.go b/routers/repo/issue_label_test.go index ae4a2c2a3e07..dfe6194eb735 100644 --- a/routers/repo/issue_label_test.go +++ b/routers/repo/issue_label_test.go @@ -120,6 +120,7 @@ func TestDeleteLabel(t *testing.T) { } func TestUpdateIssueLabel_Clear(t *testing.T) { + setting.Service.EnableIssues = true models.PrepareTestEnv(t) ctx := test.MockContext(t, "user2/repo1/issues/labels") test.LoadUser(t, ctx, 2) From d91679e561c65ef279e499a498a1e45d6be2bd03 Mon Sep 17 00:00:00 2001 From: Julian Picht Date: Fri, 19 Jul 2019 10:23:30 +0200 Subject: [PATCH 06/10] Revert "set EnableIssues = true for TestUpdateIssueLabel_Clear" This reverts commit e2eb47569ed4d8cd05f89abac600b4e062f7f8a7. Signed-off-by: Julian Picht --- routers/repo/issue_label_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/routers/repo/issue_label_test.go b/routers/repo/issue_label_test.go index dfe6194eb735..ae4a2c2a3e07 100644 --- a/routers/repo/issue_label_test.go +++ b/routers/repo/issue_label_test.go @@ -120,7 +120,6 @@ func TestDeleteLabel(t *testing.T) { } func TestUpdateIssueLabel_Clear(t *testing.T) { - setting.Service.EnableIssues = true models.PrepareTestEnv(t) ctx := test.MockContext(t, "user2/repo1/issues/labels") test.LoadUser(t, ctx, 2) From 161500b0f48a3b1b557d0d663d5e76cb8638f0d7 Mon Sep 17 00:00:00 2001 From: Julian Picht Date: Fri, 19 Jul 2019 10:24:19 +0200 Subject: [PATCH 07/10] Actually set default values for Service.EnableWiki and Service.EnableIssues Signed-off-by: Julian Picht --- modules/setting/service.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/setting/service.go b/modules/setting/service.go index 2147eaedcf82..722c32369313 100644 --- a/modules/setting/service.go +++ b/modules/setting/service.go @@ -11,7 +11,7 @@ import ( ) // Service settings -var Service struct { +var Service = struct { DefaultOrgVisibility string DefaultOrgVisibilityMode structs.VisibleType ActiveCodeLives int @@ -52,6 +52,9 @@ var Service struct { // global feature flags EnableWiki bool EnableIssues bool +}{ + EnableWiki: true, + EnableIssues: true, } func newService() { From fe8ae3695848bc596ca6e84d6ab787349c9718f3 Mon Sep 17 00:00:00 2001 From: Julian Picht Date: Tue, 23 Jul 2019 11:21:59 +0200 Subject: [PATCH 08/10] Fix the repository options page not displaying pull request options Signed-off-by: Julian Picht --- templates/repo/settings/options.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 7e320c405a26..4f894b01f0bd 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -109,7 +109,7 @@ {{.i18n.Tr "repo.settings.advanced_settings"}}
- {{if and (not .Service.EnableWiki) (not .Service.EnableIssues)}} + {{if and (not .Service.EnableWiki) (not .Service.EnableIssues) (not .Repository.CanEnablePulls)}}
From c8d84df0513c5d3e1234d0e6d36f292ec7896c06 Mon Sep 17 00:00:00 2001 From: Julian Picht Date: Wed, 7 Aug 2019 10:22:22 +0200 Subject: [PATCH 09/10] move config options Service.EnableWiki, Server.EnableWiki to Repository Signed-off-by: Julian Picht --- custom/conf/app.ini.sample | 8 ++++---- models/repo.go | 4 ++-- modules/setting/repository.go | 11 +++++++++++ modules/setting/service.go | 13 +------------ routers/api/v1/api.go | 2 +- routers/repo/activity.go | 2 +- routers/repo/issue.go | 6 +++--- routers/repo/issue_label_test.go | 2 +- routers/repo/setting.go | 4 ++-- routers/repo/wiki.go | 2 +- routers/user/home.go | 2 +- templates/base/head_navbar.tmpl | 2 +- templates/repo/header.tmpl | 6 +++--- templates/repo/settings/options.tmpl | 6 +++--- 14 files changed, 35 insertions(+), 35 deletions(-) diff --git a/custom/conf/app.ini.sample b/custom/conf/app.ini.sample index 4409431dbcb0..2a5a70e65ca4 100644 --- a/custom/conf/app.ini.sample +++ b/custom/conf/app.ini.sample @@ -39,6 +39,10 @@ ACCESS_CONTROL_ALLOW_ORIGIN = USE_COMPAT_SSH_URI = false ; Close issues as long as a commit on any branch marks it as fixed DEFAULT_CLOSE_ISSUES_VIA_COMMITS_IN_ANY_BRANCH = false +; Set this to false to completely disable the wiki function +ENABLE_WIKI = true +; Set this to false to completely disable the issue function +ENABLE_ISSUES = true [repository.editor] ; List of file extensions for which lines should be wrapped in the CodeMirror editor @@ -424,10 +428,6 @@ SHOW_REGISTRATION_BUTTON = true ; When adding a repo to a team or creating a new repo all team members will watch the ; repo automatically if enabled AUTO_WATCH_NEW_REPOS = true -; Set this to false to completely disable the wiki function -ENABLE_WIKI = true -; Set this to false to completely disable the issue function -ENABLE_ISSUES = true [webhook] ; Hook task queue length, increase if webhook shooting starts hanging diff --git a/models/repo.go b/models/repo.go index e84ffb225de6..646d6aec8819 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1278,7 +1278,7 @@ func createRepository(e *xorm.Session, doer, u *User, repo *Repository) (err err var units = make([]RepoUnit, 0, len(DefaultRepoUnits)) for _, tp := range DefaultRepoUnits { if tp == UnitTypeIssues { - if !setting.Service.EnableIssues { + if !setting.Repository.EnableIssues { continue } units = append(units, RepoUnit{ @@ -1291,7 +1291,7 @@ func createRepository(e *xorm.Session, doer, u *User, repo *Repository) (err err }, }) } else if tp == UnitTypeWiki { - if !setting.Service.EnableWiki { + if !setting.Repository.EnableWiki { continue } } else if tp == UnitTypePullRequests { diff --git a/modules/setting/repository.go b/modules/setting/repository.go index 98e3d6e82624..e5a2c212d4b3 100644 --- a/modules/setting/repository.go +++ b/modules/setting/repository.go @@ -64,6 +64,10 @@ var ( Issue struct { LockReasons []string } `ini:"repository.issue"` + + // global feature flags + EnableWiki bool + EnableIssues bool }{ AnsiCharset: "", ForcePrivate: false, @@ -121,6 +125,9 @@ var ( }{ LockReasons: strings.Split("Too heated,Off-topic,Spam,Resolved", ","), }, + + EnableWiki: true, + EnableIssues: true, } RepoRootPath string ScriptType = "bash" @@ -147,6 +154,10 @@ func newRepository() { } ScriptType = sec.Key("SCRIPT_TYPE").MustString("bash") + // feature flags + Repository.EnableIssues = sec.Key("ENABLE_ISSUES").MustBool(true) + Repository.EnableWiki = sec.Key("ENABLE_WIKI").MustBool(true) + if err = Cfg.Section("repository").MapTo(&Repository); err != nil { log.Fatal("Failed to map Repository settings: %v", err) } else if err = Cfg.Section("repository.editor").MapTo(&Repository.Editor); err != nil { diff --git a/modules/setting/service.go b/modules/setting/service.go index 722c32369313..97babc5aaf21 100644 --- a/modules/setting/service.go +++ b/modules/setting/service.go @@ -11,7 +11,7 @@ import ( ) // Service settings -var Service = struct { +var Service struct { DefaultOrgVisibility string DefaultOrgVisibilityMode structs.VisibleType ActiveCodeLives int @@ -48,13 +48,6 @@ var Service = struct { EnableOpenIDSignUp bool OpenIDWhitelist []*regexp.Regexp OpenIDBlacklist []*regexp.Regexp - - // global feature flags - EnableWiki bool - EnableIssues bool -}{ - EnableWiki: true, - EnableIssues: true, } func newService() { @@ -90,10 +83,6 @@ func newService() { Service.DefaultOrgVisibility = sec.Key("DEFAULT_ORG_VISIBILITY").In("public", structs.ExtractKeysFromMapString(structs.VisibilityModes)) Service.DefaultOrgVisibilityMode = structs.VisibilityModes[Service.DefaultOrgVisibility] - // feature flags - Service.EnableIssues = sec.Key("ENABLE_ISSUES").MustBool(true) - Service.EnableWiki = sec.Key("ENABLE_WIKI").MustBool(true) - sec = Cfg.Section("openid") Service.EnableOpenIDSignIn = sec.Key("ENABLE_OPENID_SIGNIN").MustBool(!InstallLock) Service.EnableOpenIDSignUp = sec.Key("ENABLE_OPENID_SIGNUP").MustBool(!Service.DisableRegistration && Service.EnableOpenIDSignIn) diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index da54f8accb19..9605921f2af7 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -454,7 +454,7 @@ func mustAllowPulls(ctx *context.APIContext) { } func mustEnableIssuesOrPulls(ctx *context.APIContext) { - if (!setting.Service.EnableIssues || !ctx.Repo.CanRead(models.UnitTypeIssues)) && + if (!setting.Repository.EnableIssues || !ctx.Repo.CanRead(models.UnitTypeIssues)) && !(ctx.Repo.Repository.CanEnablePulls() && ctx.Repo.CanRead(models.UnitTypePullRequests)) { if ctx.Repo.Repository.CanEnablePulls() && log.IsTrace() { if ctx.IsSigned { diff --git a/routers/repo/activity.go b/routers/repo/activity.go index 6581529cc8a7..b62b9516a603 100644 --- a/routers/repo/activity.go +++ b/routers/repo/activity.go @@ -47,7 +47,7 @@ func Activity(ctx *context.Context) { var err error if ctx.Data["Activity"], err = models.GetActivityStats(ctx.Repo.Repository, timeFrom, ctx.Repo.CanRead(models.UnitTypeReleases), - setting.Service.EnableIssues && ctx.Repo.CanRead(models.UnitTypeIssues), + setting.Repository.EnableIssues && ctx.Repo.CanRead(models.UnitTypeIssues), ctx.Repo.CanRead(models.UnitTypePullRequests), ctx.Repo.CanRead(models.UnitTypeCode)); err != nil { ctx.ServerError("GetActivityStats", err) diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 703f9306783b..b40251b96d08 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -73,7 +73,7 @@ func MustAllowUserComment(ctx *context.Context) { // MustEnableIssues check if repository enable internal issues func MustEnableIssues(ctx *context.Context) { - if !setting.Service.EnableIssues || + if !setting.Repository.EnableIssues || (!ctx.Repo.CanRead(models.UnitTypeIssues) && !ctx.Repo.CanRead(models.UnitTypeExternalTracker)) { ctx.NotFound("MustEnableIssues", nil) @@ -988,7 +988,7 @@ func GetActionIssue(ctx *context.Context) *models.Issue { func checkIssueRights(ctx *context.Context, issue *models.Issue) { if issue.IsPull && !ctx.Repo.CanRead(models.UnitTypePullRequests) || - !issue.IsPull && (!setting.Service.EnableIssues || !ctx.Repo.CanRead(models.UnitTypeIssues)) { + !issue.IsPull && (!setting.Repository.EnableIssues || !ctx.Repo.CanRead(models.UnitTypeIssues)) { ctx.NotFound("IssueOrPullRequestUnitNotAllowed", nil) } } @@ -1013,7 +1013,7 @@ func getActionIssues(ctx *context.Context) []*models.Issue { return nil } // Check access rights for all issues - issueUnitEnabled := setting.Service.EnableIssues && ctx.Repo.CanRead(models.UnitTypeIssues) + issueUnitEnabled := setting.Repository.EnableIssues && ctx.Repo.CanRead(models.UnitTypeIssues) prUnitEnabled := ctx.Repo.CanRead(models.UnitTypePullRequests) for _, issue := range issues { if issue.IsPull && !prUnitEnabled || !issue.IsPull && !issueUnitEnabled { diff --git a/routers/repo/issue_label_test.go b/routers/repo/issue_label_test.go index ae4a2c2a3e07..becb8d8ce6d4 100644 --- a/routers/repo/issue_label_test.go +++ b/routers/repo/issue_label_test.go @@ -134,7 +134,7 @@ func TestUpdateIssueLabel_Clear(t *testing.T) { } func TestUpdateIssueLabel_Toggle(t *testing.T) { - setting.Service.EnableIssues = true + setting.Repository.EnableIssues = true for _, testCase := range []struct { Action string IssueIDs []int64 diff --git a/routers/repo/setting.go b/routers/repo/setting.go index af6cc7643439..f9be94128719 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -218,7 +218,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) { }) } - if form.EnableWiki && setting.Service.EnableWiki { + if form.EnableWiki && setting.Repository.EnableWiki { if form.EnableExternalWiki { if !validation.IsValidExternalURL(form.ExternalWikiURL) { ctx.Flash.Error(ctx.Tr("repo.settings.external_wiki_url_error")) @@ -242,7 +242,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) { } } - if form.EnableIssues && setting.Service.EnableIssues { + if form.EnableIssues && setting.Repository.EnableIssues { if form.EnableExternalTracker { if !validation.IsValidExternalURL(form.ExternalTrackerURL) { ctx.Flash.Error(ctx.Tr("repo.settings.external_tracker_url_error")) diff --git a/routers/repo/wiki.go b/routers/repo/wiki.go index d8ea86a62684..5331442b1a30 100644 --- a/routers/repo/wiki.go +++ b/routers/repo/wiki.go @@ -33,7 +33,7 @@ const ( // MustEnableWiki check if wiki is enabled, if external then redirect func MustEnableWiki(ctx *context.Context) { - if !setting.Service.EnableWiki { + if !setting.Repository.EnableWiki { ctx.NotFound("MustEnableWiki", nil) return } diff --git a/routers/user/home.go b/routers/user/home.go index 2f2e58d7827d..181f85ba328c 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -308,7 +308,7 @@ func Issues(ctx *context.Context) { ctx.ServerError("GetUserRepoPermission", fmt.Errorf("[%d]%v", repoID, err)) return } - if !setting.Service.EnableIssues || !perm.CanRead(models.UnitTypeIssues) { + if !setting.Repository.EnableIssues || !perm.CanRead(models.UnitTypeIssues) { if log.IsTrace() { log.Trace("Permission Denied: User %-v cannot read %-v of repo %-v\n"+ "User in repo has Permissions: %-+v", diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index 5044cd30e6e6..1293d258053d 100644 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -10,7 +10,7 @@ {{if .IsSigned}} {{.i18n.Tr "dashboard"}} - {{if .Service.EnableIssues}} + {{if .Repository.EnableIssues}} {{.i18n.Tr "issues"}} {{end}} {{.i18n.Tr "pull_requests"}} diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 8adb264a6fac..0e18c793ba9c 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -55,13 +55,13 @@ {{end}} - {{if and .Service.EnableIssues (.Permission.CanRead $.UnitTypeIssues)}} + {{if and .Repository.EnableIssues (.Permission.CanRead $.UnitTypeIssues)}} {{.i18n.Tr "repo.issues"}} {{.Repository.NumOpenIssues}} {{end}} - {{if and .Service.EnableIssues (.Permission.CanRead $.UnitTypeExternalTracker)}} + {{if and .Repository.EnableIssues (.Permission.CanRead $.UnitTypeExternalTracker)}} {{.i18n.Tr "repo.issues"}} @@ -79,7 +79,7 @@ {{end}} - {{if and .Service.EnableWiki (or (.Permission.CanRead $.UnitTypeWiki) (.Permission.CanRead $.UnitTypeExternalWiki))}} + {{if and .Repository.EnableWiki (or (.Permission.CanRead $.UnitTypeWiki) (.Permission.CanRead $.UnitTypeExternalWiki))}} {{.i18n.Tr "repo.wiki"}} diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 4f894b01f0bd..8a9dab0379f7 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -109,7 +109,7 @@ {{.i18n.Tr "repo.settings.advanced_settings"}}
- {{if and (not .Service.EnableWiki) (not .Service.EnableIssues) (not .Repository.CanEnablePulls)}} + {{if and (not .Repository.EnableWiki) (not .Repository.EnableIssues) (not .Repository.CanEnablePulls)}}
@@ -121,7 +121,7 @@ {{.CsrfTokenHtml}} - {{if .Service.EnableWiki}} + {{if .Repository.EnableWiki}} {{$isWikiEnabled := or (.Repository.UnitEnabled $.UnitTypeWiki) (.Repository.UnitEnabled $.UnitTypeExternalWiki)}}
@@ -157,7 +157,7 @@
- {{if .Service.EnableIssues}} + {{if .Repository.EnableIssues}} {{$isIssuesEnabled := or (.Repository.UnitEnabled $.UnitTypeIssues) (.Repository.UnitEnabled $.UnitTypeExternalTracker)}}
From 3647ab64d8b645c15f9802b209fc5444eada7548 Mon Sep 17 00:00:00 2001 From: Julian Picht Date: Wed, 7 Aug 2019 15:34:47 +0200 Subject: [PATCH 10/10] Fix ".Repository" in templates maps to different type on different pages Signed-off-by: Julian Picht --- routers/routes/routes.go | 4 ++++ templates/base/head_navbar.tmpl | 2 +- templates/repo/header.tmpl | 6 +++--- templates/repo/settings/options.tmpl | 6 +++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 0b9e20a3e653..d6202ade7a0d 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -253,6 +253,10 @@ func RegisterRoutes(m *macaron.Macaron) { } m.Use(user.GetNotificationCount) + m.Use(func(ctx *context.Context) { + ctx.Data["GlobalEnableWiki"] = setting.Repository.EnableWiki + ctx.Data["GlobalEnableIssues"] = setting.Repository.EnableIssues + }) // FIXME: not all routes need go through same middlewares. // Especially some AJAX requests, we can reduce middleware number to improve performance. diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index 1293d258053d..8dd0dd46b3d1 100644 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -10,7 +10,7 @@ {{if .IsSigned}} {{.i18n.Tr "dashboard"}} - {{if .Repository.EnableIssues}} + {{if .GlobalEnableIssues}} {{.i18n.Tr "issues"}} {{end}} {{.i18n.Tr "pull_requests"}} diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 0e18c793ba9c..af4ee976525d 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -55,13 +55,13 @@ {{end}} - {{if and .Repository.EnableIssues (.Permission.CanRead $.UnitTypeIssues)}} + {{if and .GlobalEnableIssues (.Permission.CanRead $.UnitTypeIssues)}} {{.i18n.Tr "repo.issues"}} {{.Repository.NumOpenIssues}} {{end}} - {{if and .Repository.EnableIssues (.Permission.CanRead $.UnitTypeExternalTracker)}} + {{if and .GlobalEnableIssues (.Permission.CanRead $.UnitTypeExternalTracker)}} {{.i18n.Tr "repo.issues"}} @@ -79,7 +79,7 @@ {{end}} - {{if and .Repository.EnableWiki (or (.Permission.CanRead $.UnitTypeWiki) (.Permission.CanRead $.UnitTypeExternalWiki))}} + {{if and .GlobalEnableWiki (or (.Permission.CanRead $.UnitTypeWiki) (.Permission.CanRead $.UnitTypeExternalWiki))}} {{.i18n.Tr "repo.wiki"}} diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 8a9dab0379f7..2f864cb9933f 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -109,7 +109,7 @@ {{.i18n.Tr "repo.settings.advanced_settings"}}
- {{if and (not .Repository.EnableWiki) (not .Repository.EnableIssues) (not .Repository.CanEnablePulls)}} + {{if and (not .GlobalEnableWiki) (not .GlobalEnableIssues) (not .Repository.CanEnablePulls)}}
@@ -121,7 +121,7 @@ {{.CsrfTokenHtml}} - {{if .Repository.EnableWiki}} + {{if .GlobalEnableWiki}} {{$isWikiEnabled := or (.Repository.UnitEnabled $.UnitTypeWiki) (.Repository.UnitEnabled $.UnitTypeExternalWiki)}}
@@ -157,7 +157,7 @@
- {{if .Repository.EnableIssues}} + {{if .GlobalEnableIssues}} {{$isIssuesEnabled := or (.Repository.UnitEnabled $.UnitTypeIssues) (.Repository.UnitEnabled $.UnitTypeExternalTracker)}}