diff options
author | Lanre Adelowo <adelowomailbox@gmail.com> | 2019-02-10 20:27:19 +0100 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2019-02-10 21:27:19 +0200 |
commit | 9d8178b3ac5f86a64f67ab7b5dea99347a5afe72 (patch) | |
tree | ed560142815927211f7d52db859728b88f0d9734 /routers | |
parent | c0adb5ea8bd0b2551a8c414b54ef5bc67882de55 (diff) | |
download | gitea-9d8178b3ac5f86a64f67ab7b5dea99347a5afe72.tar.gz gitea-9d8178b3ac5f86a64f67ab7b5dea99347a5afe72.zip |
Add option to close issues via commit on a non master branch (#5992)
* fixes #5957
* add tests to make sure config option is respected
* use already defined struct
* - use migration to make the flag repo wide not for the entire gitea instance
Also note that the config value can still be set so as to be able to control the value for new repositories that are to be created
- fix copy/paste error in copyright header year and rearrange import
- use repo config instead of server config value to determine if a commit should close an issue
- update testsuite
* use global config only when creating a new repository
* allow repo admin toggle feature via UI
* fix typo and improve testcase
* fix fixtures
* add DEFAULT prefix to config value
* fix test
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/setting.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 4fb74f6cfa..5b5eaeb288 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -250,13 +250,19 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) { if repo.IsFsckEnabled != form.EnableHealthCheck { repo.IsFsckEnabled = form.EnableHealthCheck - if err := models.UpdateRepository(repo, false); err != nil { - ctx.ServerError("UpdateRepository", err) - return - } - log.Trace("Repository admin settings updated: %s/%s", ctx.Repo.Owner.Name, repo.Name) } + if repo.CloseIssuesViaCommitInAnyBranch != form.EnableCloseIssuesViaCommitInAnyBranch { + repo.CloseIssuesViaCommitInAnyBranch = form.EnableCloseIssuesViaCommitInAnyBranch + } + + if err := models.UpdateRepository(repo, false); err != nil { + ctx.ServerError("UpdateRepository", err) + return + } + + log.Trace("Repository admin settings updated: %s/%s", ctx.Repo.Owner.Name, repo.Name) + ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success")) ctx.Redirect(ctx.Repo.RepoLink + "/settings") |