mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-24 10:46:10 +01:00
9d8178b3ac
* 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
28 lines
721 B
Go
28 lines
721 B
Go
// Copyright 2019 The Gitea Authors. All rights reserved.
|
|
// Use of this source code is governed by a MIT-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package migrations
|
|
|
|
import (
|
|
"code.gitea.io/gitea/modules/setting"
|
|
|
|
"github.com/go-xorm/xorm"
|
|
)
|
|
|
|
func addCanCloseIssuesViaCommitInAnyBranch(x *xorm.Engine) error {
|
|
|
|
type Repository struct {
|
|
ID int64 `xorm:"pk autoincr"`
|
|
CloseIssuesViaCommitInAnyBranch bool `xorm:"NOT NULL DEFAULT false"`
|
|
}
|
|
|
|
if err := x.Sync2(new(Repository)); err != nil {
|
|
return err
|
|
}
|
|
|
|
_, err := x.Exec("UPDATE repository SET close_issues_via_commit_in_any_branch = ?",
|
|
setting.Repository.DefaultCloseIssuesViaCommitsInAnyBranch)
|
|
return err
|
|
}
|