CreateIssueComment creates a plain issue comment.
(doer *User, repo *Repository, issue *Issue, content string, attachments []string)
| 334 | |
| 335 | // CreateIssueComment creates a plain issue comment. |
| 336 | func CreateIssueComment(doer *User, repo *Repository, issue *Issue, content string, attachments []string) (*Comment, error) { |
| 337 | comment, err := CreateComment(&CreateCommentOptions{ |
| 338 | Type: CommentTypeComment, |
| 339 | Doer: doer, |
| 340 | Repo: repo, |
| 341 | Issue: issue, |
| 342 | Content: content, |
| 343 | Attachments: attachments, |
| 344 | }) |
| 345 | if err != nil { |
| 346 | return nil, errors.Newf("CreateComment: %v", err) |
| 347 | } |
| 348 | |
| 349 | comment.Issue = issue |
| 350 | if err = PrepareWebhooks(repo, HookEventTypeIssueComment, &api.IssueCommentPayload{ |
| 351 | Action: api.HOOK_ISSUE_COMMENT_CREATED, |
| 352 | Issue: issue.APIFormat(), |
| 353 | Comment: comment.APIFormat(), |
| 354 | Repository: repo.APIFormatLegacy(nil), |
| 355 | Sender: doer.APIFormat(), |
| 356 | }); err != nil { |
| 357 | log.Error("PrepareWebhooks [comment_id: %d]: %v", comment.ID, err) |
| 358 | } |
| 359 | |
| 360 | return comment, nil |
| 361 | } |
| 362 | |
| 363 | // CreateRefComment creates a commit reference comment to issue. |
| 364 | func CreateRefComment(doer *User, repo *Repository, issue *Issue, content, commitSHA string) error { |
no test coverage detected