|
|
@ -714,11 +714,6 @@ func updateIssueCols(e Engine, issue *Issue, cols ...string) error { |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// UpdateIssueCols only updates values of specific columns for given issue.
|
|
|
|
|
|
|
|
func UpdateIssueCols(issue *Issue, cols ...string) error { |
|
|
|
|
|
|
|
return updateIssueCols(x, issue, cols...) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (issue *Issue) changeStatus(e *xorm.Session, doer *User, isClosed bool) (err error) { |
|
|
|
func (issue *Issue) changeStatus(e *xorm.Session, doer *User, isClosed bool) (err error) { |
|
|
|
// Reload the issue
|
|
|
|
// Reload the issue
|
|
|
|
currentIssue, err := getIssueByID(e, issue.ID) |
|
|
|
currentIssue, err := getIssueByID(e, issue.ID) |
|
|
@ -844,9 +839,7 @@ func (issue *Issue) ChangeStatus(doer *User, isClosed bool) (err error) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ChangeTitle changes the title of this issue, as the given user.
|
|
|
|
// ChangeTitle changes the title of this issue, as the given user.
|
|
|
|
func (issue *Issue) ChangeTitle(doer *User, title string) (err error) { |
|
|
|
func (issue *Issue) ChangeTitle(doer *User, oldTitle string) (err error) { |
|
|
|
oldTitle := issue.Title |
|
|
|
|
|
|
|
issue.Title = title |
|
|
|
|
|
|
|
sess := x.NewSession() |
|
|
|
sess := x.NewSession() |
|
|
|
defer sess.Close() |
|
|
|
defer sess.Close() |
|
|
|
|
|
|
|
|
|
|
@ -862,7 +855,7 @@ func (issue *Issue) ChangeTitle(doer *User, title string) (err error) { |
|
|
|
return fmt.Errorf("loadRepo: %v", err) |
|
|
|
return fmt.Errorf("loadRepo: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if _, err = createChangeTitleComment(sess, doer, issue.Repo, issue, oldTitle, title); err != nil { |
|
|
|
if _, err = createChangeTitleComment(sess, doer, issue.Repo, issue, oldTitle, issue.Title); err != nil { |
|
|
|
return fmt.Errorf("createChangeTitleComment: %v", err) |
|
|
|
return fmt.Errorf("createChangeTitleComment: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -874,51 +867,7 @@ func (issue *Issue) ChangeTitle(doer *User, title string) (err error) { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if err = sess.Commit(); err != nil { |
|
|
|
return sess.Commit() |
|
|
|
return err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
sess.Close() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mode, _ := AccessLevel(issue.Poster, issue.Repo) |
|
|
|
|
|
|
|
if issue.IsPull { |
|
|
|
|
|
|
|
if err = issue.loadPullRequest(sess); err != nil { |
|
|
|
|
|
|
|
return fmt.Errorf("loadPullRequest: %v", err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
issue.PullRequest.Issue = issue |
|
|
|
|
|
|
|
err = PrepareWebhooks(issue.Repo, HookEventPullRequest, &api.PullRequestPayload{ |
|
|
|
|
|
|
|
Action: api.HookIssueEdited, |
|
|
|
|
|
|
|
Index: issue.Index, |
|
|
|
|
|
|
|
Changes: &api.ChangesPayload{ |
|
|
|
|
|
|
|
Title: &api.ChangesFromPayload{ |
|
|
|
|
|
|
|
From: oldTitle, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
PullRequest: issue.PullRequest.APIFormat(), |
|
|
|
|
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
|
|
|
|
Sender: doer.APIFormat(), |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
err = PrepareWebhooks(issue.Repo, HookEventIssues, &api.IssuePayload{ |
|
|
|
|
|
|
|
Action: api.HookIssueEdited, |
|
|
|
|
|
|
|
Index: issue.Index, |
|
|
|
|
|
|
|
Changes: &api.ChangesPayload{ |
|
|
|
|
|
|
|
Title: &api.ChangesFromPayload{ |
|
|
|
|
|
|
|
From: oldTitle, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
Issue: issue.APIFormat(), |
|
|
|
|
|
|
|
Repository: issue.Repo.APIFormat(mode), |
|
|
|
|
|
|
|
Sender: issue.Poster.APIFormat(), |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
log.Error("PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
go HookQueue.Add(issue.RepoID) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return nil |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// AddDeletePRBranchComment adds delete branch comment for pull request issue
|
|
|
|
// AddDeletePRBranchComment adds delete branch comment for pull request issue
|
|
|
|