}
// FindComments returns all comments according options
-func FindComments(ctx context.Context, opts *FindCommentsOptions) ([]*Comment, error) {
+func FindComments(ctx context.Context, opts *FindCommentsOptions) (CommentList, error) {
comments := make([]*Comment, 0, 10)
sess := db.GetEngine(ctx).Where(opts.ToConds())
if opts.RepoID > 0 {
}
func findCodeComments(ctx context.Context, opts FindCommentsOptions, issue *Issue, currentUser *user_model.User, review *Review) ([]*Comment, error) {
- var comments []*Comment
+ var comments CommentList
if review == nil {
review = &Review{ID: 0}
}
return nil, err
}
- if err := CommentList(comments).LoadPosters(ctx); err != nil {
+ if err := comments.LoadPosters(ctx); err != nil {
return nil, err
}
ClosedUnix timeutil.TimeStamp `xorm:"INDEX"`
Attachments []*repo_model.Attachment `xorm:"-"`
- Comments []*Comment `xorm:"-"`
+ Comments CommentList `xorm:"-"`
Reactions ReactionList `xorm:"-"`
TotalTrackedTime int64 `xorm:"-"`
Assignees []*user_model.User `xorm:"-"`
return err
}
- if err = CommentList(issue.Comments).loadAttributes(ctx); err != nil {
+ if err = issue.Comments.loadAttributes(ctx); err != nil {
return err
}
if issue.IsTimetrackerEnabled(ctx) {
return
}
- if err := issues_model.CommentList(comments).LoadPosters(ctx); err != nil {
+ if err := comments.LoadPosters(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadPosters", err)
return
}
- if err := issues_model.CommentList(comments).LoadAttachments(ctx); err != nil {
+ if err := comments.LoadAttachments(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadAttachments", err)
return
}
return
}
- if err := issues_model.CommentList(comments).LoadPosters(ctx); err != nil {
+ if err := comments.LoadPosters(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadPosters", err)
return
}
return
}
- if err = issues_model.CommentList(comments).LoadPosters(ctx); err != nil {
+ if err = comments.LoadPosters(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadPosters", err)
return
}
apiComments := make([]*api.Comment, len(comments))
- if err := issues_model.CommentList(comments).LoadIssues(ctx); err != nil {
+ if err := comments.LoadIssues(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadIssues", err)
return
}
- if err := issues_model.CommentList(comments).LoadPosters(ctx); err != nil {
+ if err := comments.LoadPosters(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadPosters", err)
return
}
- if err := issues_model.CommentList(comments).LoadAttachments(ctx); err != nil {
+ if err := comments.LoadAttachments(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadAttachments", err)
return
}
- if _, err := issues_model.CommentList(comments).Issues().LoadRepositories(ctx); err != nil {
+ if _, err := comments.Issues().LoadRepositories(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadRepositories", err)
return
}