summaryrefslogtreecommitdiffstats
path: root/models/issue_label.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-14 03:32:24 -0700
committerUnknwon <u@gogs.io>2016-08-14 03:32:24 -0700
commit3f7f4852efaaa56a0dada832dc652a1fc8869ae7 (patch)
treee3bb1769b2967dea560b2400abf830dc6cf70067 /models/issue_label.go
parent0f33b04c876593e592887450302774654fef2787 (diff)
downloadgitea-3f7f4852efaaa56a0dada832dc652a1fc8869ae7.tar.gz
gitea-3f7f4852efaaa56a0dada832dc652a1fc8869ae7.zip
#2246 fully support of webhooks for pull request
Diffstat (limited to 'models/issue_label.go')
-rw-r--r--models/issue_label.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/models/issue_label.go b/models/issue_label.go
index ed9b616011..a3015b02cd 100644
--- a/models/issue_label.go
+++ b/models/issue_label.go
@@ -12,6 +12,8 @@ import (
"github.com/go-xorm/xorm"
+ api "github.com/gogits/go-gogs-client"
+
"github.com/gogits/gogs/modules/base"
)
@@ -27,9 +29,17 @@ type Label struct {
IsChecked bool `xorm:"-"`
}
+func (label *Label) APIFormat() *api.Label {
+ return &api.Label{
+ ID: label.ID,
+ Name: label.Name,
+ Color: label.Color,
+ }
+}
+
// CalOpenIssues calculates the open issues of label.
-func (m *Label) CalOpenIssues() {
- m.NumOpenIssues = m.NumIssues - m.NumClosedIssues
+func (label *Label) CalOpenIssues() {
+ label.NumOpenIssues = label.NumIssues - label.NumClosedIssues
}
// ForegroundColor calculates the text color for labels based