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

Function UpdateComment

internal/database/comment.go:479–502  ·  view source on GitHub ↗

UpdateComment updates information of comment.

(doer *User, c *Comment, oldContent string)

Source from the content-addressed store, hash-verified

477
478// UpdateComment updates information of comment.
479func UpdateComment(doer *User, c *Comment, oldContent string) (err error) {
480 if _, err = x.Id(c.ID).AllCols().Update(c); err != nil {
481 return err
482 }
483
484 if err = c.Issue.LoadAttributes(); err != nil {
485 log.Error("Issue.LoadAttributes [issue_id: %d]: %v", c.IssueID, err)
486 } else if err = PrepareWebhooks(c.Issue.Repo, HookEventTypeIssueComment, &api.IssueCommentPayload{
487 Action: api.HOOK_ISSUE_COMMENT_EDITED,
488 Issue: c.Issue.APIFormat(),
489 Comment: c.APIFormat(),
490 Changes: &api.ChangesPayload{
491 Body: &api.ChangesFromPayload{
492 From: oldContent,
493 },
494 },
495 Repository: c.Issue.Repo.APIFormatLegacy(nil),
496 Sender: doer.APIFormat(),
497 }); err != nil {
498 log.Error("PrepareWebhooks [comment_id: %d]: %v", c.ID, err)
499 }
500
501 return nil
502}
503
504// DeleteCommentByID deletes the comment by given ID.
505func DeleteCommentByID(doer *User, id int64) error {

Callers 2

UpdateCommentContentFunction · 0.92
EditIssueCommentFunction · 0.92

Calls 6

PrepareWebhooksFunction · 0.85
APIFormatLegacyMethod · 0.80
UpdateMethod · 0.65
LoadAttributesMethod · 0.45
ErrorMethod · 0.45
APIFormatMethod · 0.45

Tested by

no test coverage detected