summaryrefslogtreecommitdiffstats
path: root/routers/repo/issue_label.go
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2018-03-13 04:03:55 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2018-03-13 10:03:55 +0800
commitc0d41b1b77169553006bd9211d025de4da8bafd8 (patch)
tree95c704bdd07576766e2c29533578da2f3002ab64 /routers/repo/issue_label.go
parentad33730dcaffed632200316a5ce5675b30ed1e99 (diff)
downloadgitea-c0d41b1b77169553006bd9211d025de4da8bafd8.tar.gz
gitea-c0d41b1b77169553006bd9211d025de4da8bafd8.zip
Add label descriptions (#3662)
* Add label descriptions * Add default descriptions to label template
Diffstat (limited to 'routers/repo/issue_label.go')
-rw-r--r--routers/repo/issue_label.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/routers/repo/issue_label.go b/routers/repo/issue_label.go
index a197256be8..8631ef0d0b 100644
--- a/routers/repo/issue_label.go
+++ b/routers/repo/issue_label.go
@@ -42,9 +42,10 @@ func InitializeLabels(ctx *context.Context, form auth.InitializeLabelsForm) {
labels := make([]*models.Label, len(list))
for i := 0; i < len(list); i++ {
labels[i] = &models.Label{
- RepoID: ctx.Repo.Repository.ID,
- Name: list[i][0],
- Color: list[i][1],
+ RepoID: ctx.Repo.Repository.ID,
+ Name: list[i][0],
+ Description: list[i][2],
+ Color: list[i][1],
}
}
if err := models.NewLabels(labels...); err != nil {
@@ -81,9 +82,10 @@ func NewLabel(ctx *context.Context, form auth.CreateLabelForm) {
}
l := &models.Label{
- RepoID: ctx.Repo.Repository.ID,
- Name: form.Title,
- Color: form.Color,
+ RepoID: ctx.Repo.Repository.ID,
+ Name: form.Title,
+ Description: form.Description,
+ Color: form.Color,
}
if err := models.NewLabel(l); err != nil {
ctx.ServerError("NewLabel", err)
@@ -106,6 +108,7 @@ func UpdateLabel(ctx *context.Context, form auth.CreateLabelForm) {
}
l.Name = form.Title
+ l.Description = form.Description
l.Color = form.Color
if err := models.UpdateLabel(l); err != nil {
ctx.ServerError("UpdateLabel", err)