issues comment API : list, create, edit (#2966)

add `since` query string support to list issue comment
This commit is contained in:
Iwan Budi Kusnanto 2016-08-27 01:23:21 +07:00 committed by 无闻
parent f50e568fd1
commit 8dca9f95fa
3 changed files with 141 additions and 0 deletions

View file

@ -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)