diff options
author | Thibault Meyer <0xbaadf00d@users.noreply.github.com> | 2016-08-30 04:02:49 +0200 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2016-08-29 19:02:49 -0700 |
commit | 92fb30c5260cc067da28ae3cd031b76f7b7976db (patch) | |
tree | 50855703a1044069861620ca32f98e812627ea59 /models/repo.go | |
parent | 9f44c267899fabd0b180cdf6cd41e6d77b2fb423 (diff) | |
download | gitea-92fb30c5260cc067da28ae3cd031b76f7b7976db.tar.gz gitea-92fb30c5260cc067da28ae3cd031b76f7b7976db.zip |
Load a set of predefined labels (#3459)
* Can use a predefined set of labels
* Change UI
* Fix HTML file indentation
* Avoid reading file from other directory (security issue)
* Apply a better fix
* Remove not used variable
* Merge upstream/develop
* Do modifications
* Raname
* remove binding + rename variable
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/models/repo.go b/models/repo.go index bb1a9f75c0..2c19afbd17 100644 --- a/models/repo.go +++ b/models/repo.go @@ -54,7 +54,7 @@ var ( ) var ( - Gitignores, Licenses, Readmes []string + Gitignores, Licenses, Readmes, LabelTemplates []string // Maximum items per page in forks, watchers and stars of a repo ItemsPerPage = 40 @@ -62,9 +62,8 @@ var ( func LoadRepoConfig() { // Load .gitignore and license files and readme templates. - // TODO: should we allow custom files overwrite default ones? - types := []string{"gitignore", "license", "readme"} - typeFiles := make([][]string, 3) + types := []string{"gitignore", "license", "readme", "label"} + typeFiles := make([][]string, 4) for i, t := range types { files, err := bindata.AssetDir("conf/" + t) if err != nil { @@ -89,9 +88,11 @@ func LoadRepoConfig() { Gitignores = typeFiles[0] Licenses = typeFiles[1] Readmes = typeFiles[2] + LabelTemplates = typeFiles[3] sort.Strings(Gitignores) sort.Strings(Licenses) sort.Strings(Readmes) + sort.Strings(LabelTemplates) // Filter out invalid names and promote preferred licenses. sortedLicenses := make([]string, 0, len(Licenses)) |