summaryrefslogtreecommitdiffstats
path: root/models/issue_comment.go
diff options
context:
space:
mode:
authorIwan Budi Kusnanto <ibk@labhijau.net>2016-08-27 01:23:21 +0700
committer无闻 <u@gogs.io>2016-08-26 11:23:21 -0700
commit8dca9f95fab909c52cd34fb401f171d22f0065ae (patch)
tree9761dbe8dc9901ca13c10109428cdf14334de545 /models/issue_comment.go
parentf50e568fd12feda20b1a899486914881564bea12 (diff)
downloadgitea-8dca9f95fab909c52cd34fb401f171d22f0065ae.tar.gz
gitea-8dca9f95fab909c52cd34fb401f171d22f0065ae.zip
issues comment API : list, create, edit (#2966)
add `since` query string support to list issue comment
Diffstat (limited to 'models/issue_comment.go')
-rw-r--r--models/issue_comment.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/models/issue_comment.go b/models/issue_comment.go
index bd1a089ba6..8abc063328 100644
--- a/models/issue_comment.go
+++ b/models/issue_comment.go
@@ -11,6 +11,7 @@ import (
"github.com/Unknwon/com"
"github.com/go-xorm/xorm"
+ api "github.com/gogits/go-gogs-client"
"github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/markdown"
@@ -104,6 +105,18 @@ func (c *Comment) AfterDelete() {
}
}
+// APIFormat convert Comment struct to api.Comment struct
+func (c *Comment) APIFormat() *api.Comment {
+ apiComment := &api.Comment{
+ ID: c.ID,
+ Poster: c.Poster.APIFormat(),
+ Body: c.Content,
+ Created: c.Created,
+ }
+
+ return apiComment
+}
+
// HashTag returns unique hash tag for comment.
func (c *Comment) HashTag() string {
return "issuecomment-" + com.ToStr(c.ID)