MCPcopy Create free account
hub / github.com/gogs/gogs / ChangeTitle

Method ChangeTitle

internal/database/issue.go:523–563  ·  view source on GitHub ↗
(doer *User, title string)

Source from the content-addressed store, hash-verified

521}
522
523func (issue *Issue) ChangeTitle(doer *User, title string) (err error) {
524 oldTitle := issue.Title
525 issue.Title = title
526 if err = UpdateIssueCols(issue, "name"); err != nil {
527 return errors.Newf("UpdateIssueCols: %v", err)
528 }
529
530 if issue.IsPull {
531 issue.PullRequest.Issue = issue
532 err = PrepareWebhooks(issue.Repo, HookEventTypePullRequest, &api.PullRequestPayload{
533 Action: api.HOOK_ISSUE_EDITED,
534 Index: issue.Index,
535 PullRequest: issue.PullRequest.APIFormat(),
536 Changes: &api.ChangesPayload{
537 Title: &api.ChangesFromPayload{
538 From: oldTitle,
539 },
540 },
541 Repository: issue.Repo.APIFormatLegacy(nil),
542 Sender: doer.APIFormat(),
543 })
544 } else {
545 err = PrepareWebhooks(issue.Repo, HookEventTypeIssues, &api.IssuesPayload{
546 Action: api.HOOK_ISSUE_EDITED,
547 Index: issue.Index,
548 Issue: issue.APIFormat(),
549 Changes: &api.ChangesPayload{
550 Title: &api.ChangesFromPayload{
551 From: oldTitle,
552 },
553 },
554 Repository: issue.Repo.APIFormatLegacy(nil),
555 Sender: doer.APIFormat(),
556 })
557 }
558 if err != nil {
559 log.Error("PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
560 }
561
562 return nil
563}
564
565func (issue *Issue) ChangeContent(doer *User, content string) (err error) {
566 oldContent := issue.Content

Callers 1

UpdateIssueTitleFunction · 0.80

Implementers 1

mailerIssueinternal/database/issue_mail.go

Calls 5

APIFormatMethod · 0.95
UpdateIssueColsFunction · 0.85
PrepareWebhooksFunction · 0.85
APIFormatLegacyMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected