MCPcopy Index your code
hub / github.com/gogs/gogs / CreateIssueComment

Function CreateIssueComment

internal/database/comment.go:336–361  ·  view source on GitHub ↗

CreateIssueComment creates a plain issue comment.

(doer *User, repo *Repository, issue *Issue, content string, attachments []string)

Source from the content-addressed store, hash-verified

334
335// CreateIssueComment creates a plain issue comment.
336func 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.
364func CreateRefComment(doer *User, repo *Repository, issue *Issue, content, commitSHA string) error {

Callers 2

NewCommentFunction · 0.92
CreateIssueCommentFunction · 0.92

Calls 5

PrepareWebhooksFunction · 0.85
APIFormatLegacyMethod · 0.80
CreateCommentFunction · 0.70
APIFormatMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected