From 8dca9f95fab909c52cd34fb401f171d22f0065ae Mon Sep 17 00:00:00 2001 From: Iwan Budi Kusnanto Date: Sat, 27 Aug 2016 01:23:21 +0700 Subject: issues comment API : list, create, edit (#2966) add `since` query string support to list issue comment --- models/issue_comment.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'models/issue_comment.go') diff --git a/models/issue_comment.go b/models/issue_comment.go index bd1a089b..8abc0633 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) -- cgit v1.2.3