aboutsummaryrefslogtreecommitdiff
path: root/models/issue_comment.go
diff options
context:
space:
mode:
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 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)