Fix #2001 and fix issue comments hidden (#2016)

* revert #2001 and fix issue comments hidden

* fix #2001

* fix import

* improve comment type

* reduce unnecessary join

* fix comment on FindCommentsOptions
This commit is contained in:
Lunny Xiao 2017-06-21 09:00:44 +08:00 committed by GitHub
parent 0a5dc640a1
commit d71fad2ab7
3 changed files with 68 additions and 27 deletions

View file

@ -27,7 +27,11 @@ func ListIssueComments(ctx *context.APIContext) {
return
}
comments, err := models.GetCommentsByIssueIDSince(issue.ID, since.Unix())
comments, err := models.FindComments(models.FindCommentsOptions{
IssueID: issue.ID,
Since: since.Unix(),
Type: models.CommentTypeComment,
})
if err != nil {
ctx.Error(500, "GetCommentsByIssueIDSince", err)
return
@ -47,7 +51,11 @@ func ListRepoIssueComments(ctx *context.APIContext) {
since, _ = time.Parse(time.RFC3339, ctx.Query("since"))
}
comments, err := models.GetCommentsByRepoIDSince(ctx.Repo.Repository.ID, since.Unix())
comments, err := models.FindComments(models.FindCommentsOptions{
RepoID: ctx.Repo.Repository.ID,
Since: since.Unix(),
Type: models.CommentTypeComment,
})
if err != nil {
ctx.Error(500, "GetCommentsByRepoIDSince", err)
return