(doer *User, title string)
| 521 | } |
| 522 | |
| 523 | func (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 | |
| 565 | func (issue *Issue) ChangeContent(doer *User, content string) (err error) { |
| 566 | oldContent := issue.Content |
no test coverage detected