summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorJulien Tant <julien@craftyx.fr>2018-08-13 21:04:39 +0200
committerLauris BH <lauris@nix.lv>2018-08-13 22:04:39 +0300
commit7781e8cef2dfe73d71be7804f4c5a7c5f1995d31 (patch)
tree7bbe6d2a031655478538e152912182f5ad3500eb /modules
parent52c2cb15db77a381880db7e44f133a49b3516dd5 (diff)
downloadgitea-7781e8cef2dfe73d71be7804f4c5a7c5f1995d31.tar.gz
gitea-7781e8cef2dfe73d71be7804f4c5a7c5f1995d31.zip
Disable merging a WIP Pull request (#4529)
* prevent pull request to be merged when PR is a WIP * add tests * add helper to prepend WIP: in PR title * move default wip prefixes into settings * use configurable WIP prefixes in javascript and default to first one in templates * add documentation * add unit test on pull model Signed-off-by: Julien Tant <julien@craftyx.fr>
Diffstat (limited to 'modules')
-rw-r--r--modules/setting/defaults.go5
-rw-r--r--modules/setting/setting.go14
2 files changed, 17 insertions, 2 deletions
diff --git a/modules/setting/defaults.go b/modules/setting/defaults.go
index 527a6af3b9..7630d10090 100644
--- a/modules/setting/defaults.go
+++ b/modules/setting/defaults.go
@@ -5,6 +5,7 @@ import (
)
var (
- defaultLangs = strings.Split("en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,uk-UA,ja-JP,es-ES,pt-BR,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR", ",")
- defaultLangNames = strings.Split("English,简体中文,繁體中文(香港),繁體中文(台灣),Deutsch,français,Nederlands,latviešu,русский,Українська,日本語,español,português do Brasil,polski,български,italiano,suomi,Türkçe,čeština,српски,svenska,한국어", ",")
+ defaultLangs = strings.Split("en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,uk-UA,ja-JP,es-ES,pt-BR,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR", ",")
+ defaultLangNames = strings.Split("English,简体中文,繁體中文(香港),繁體中文(台灣),Deutsch,français,Nederlands,latviešu,русский,Українська,日本語,español,português do Brasil,polski,български,italiano,suomi,Türkçe,čeština,српски,svenska,한국어", ",")
+ defaultPullRequestWorkInProgressPrefixes = strings.Split("WIP:,[WIP]", ",")
)
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 4a231c1a52..0f57098ea6 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -224,6 +224,11 @@ var (
LocalCopyPath string
LocalWikiPath string
} `ini:"-"`
+
+ // Pull request settings
+ PullRequest struct {
+ WorkInProgressPrefixes []string
+ } `ini:"repository.pull-request"`
}{
AnsiCharset: "",
ForcePrivate: false,
@@ -267,6 +272,13 @@ var (
LocalCopyPath: "tmp/local-repo",
LocalWikiPath: "tmp/local-wiki",
},
+
+ // Pull request settings
+ PullRequest: struct {
+ WorkInProgressPrefixes []string
+ }{
+ WorkInProgressPrefixes: defaultPullRequestWorkInProgressPrefixes,
+ },
}
RepoRootPath string
ScriptType = "bash"
@@ -1031,6 +1043,8 @@ func NewContext() {
log.Fatal(4, "Failed to map Repository.Upload settings: %v", err)
} else if err = Cfg.Section("repository.local").MapTo(&Repository.Local); err != nil {
log.Fatal(4, "Failed to map Repository.Local settings: %v", err)
+ } else if err = Cfg.Section("repository.pull-request").MapTo(&Repository.PullRequest); err != nil {
+ log.Fatal(4, "Failed to map Repository.PullRequest settings: %v", err)
}
if !filepath.IsAbs(Repository.Upload.TempPath) {