Clean up {Merge,New}PullRequestAction and add UpdatePullRequestAction
This commit is contained in:
parent
8a9bd7a9b7
commit
58662ff1b6
|
|
@ -584,7 +584,7 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = UpdateIssuesCommit(pusher, repo, opts.Commits.Commits, true); err != nil {
|
if err = UpdateIssuesCommit(pusher, repo, opts.Commits.Commits, true); err != nil {
|
||||||
log.Error(4, "updateIssuesCommit: %v", err)
|
log.Error(4, "UpdateIssuesCommit: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -738,8 +738,13 @@ func TransferRepoAction(doer, oldOwner *User, repo *Repository) error {
|
||||||
return transferRepoAction(x, doer, oldOwner, repo)
|
return transferRepoAction(x, doer, oldOwner, repo)
|
||||||
}
|
}
|
||||||
|
|
||||||
func mergePullRequestAction(e Engine, doer *User, repo *Repository, pull *Issue, commits *PushCommits) (err error) {
|
// MergePullRequestAction adds new action for merging pull request.
|
||||||
if err = notifyWatchers(e, &Action{
|
func MergePullRequestAction(doer *User, repo *Repository, pull *Issue, commits *PushCommits) error {
|
||||||
|
if err := UpdateIssuesCommit(doer, repo, commits.Commits, true); err != nil {
|
||||||
|
log.Error(4, "UpdateIssuesCommit: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := notifyWatchers(x, &Action{
|
||||||
ActUserID: doer.ID,
|
ActUserID: doer.ID,
|
||||||
ActUser: doer,
|
ActUser: doer,
|
||||||
OpType: ActionMergePullRequest,
|
OpType: ActionMergePullRequest,
|
||||||
|
|
@ -754,17 +759,13 @@ func mergePullRequestAction(e Engine, doer *User, repo *Repository, pull *Issue,
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MergePullRequestAction adds new action for merging pull request.
|
// NewPullRequestAction adds new action for creating a new pull request.
|
||||||
func MergePullRequestAction(actUser *User, repo *Repository, pull *Issue, commits *PushCommits) error {
|
func NewPullRequestAction(doer *User, repo *Repository, pull *Issue, commits *PushCommits) error {
|
||||||
if err := UpdateIssuesCommit(actUser, repo, commits.Commits, true); err != nil {
|
if err := UpdateIssuesCommit(doer, repo, commits.Commits, false); err != nil {
|
||||||
log.Error(4, "updateIssuesCommit: %v", err)
|
log.Error(4, "UpdateIssuesCommit: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return mergePullRequestAction(x, actUser, repo, pull, commits)
|
if err := NotifyWatchers(&Action{
|
||||||
}
|
|
||||||
|
|
||||||
func newPullRequestAction(e Engine, doer *User, repo *Repository, pull *Issue, commits *PushCommits) (err error) {
|
|
||||||
if err = NotifyWatchers(&Action{
|
|
||||||
ActUserID: doer.ID,
|
ActUserID: doer.ID,
|
||||||
ActUser: doer,
|
ActUser: doer,
|
||||||
OpType: ActionCreatePullRequest,
|
OpType: ActionCreatePullRequest,
|
||||||
|
|
@ -774,20 +775,20 @@ func newPullRequestAction(e Engine, doer *User, repo *Repository, pull *Issue, c
|
||||||
IsPrivate: repo.IsPrivate,
|
IsPrivate: repo.IsPrivate,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
log.Error(4, "NotifyWatchers: %v", err)
|
log.Error(4, "NotifyWatchers: %v", err)
|
||||||
} else if err = pull.MailParticipants(); err != nil {
|
} else if err := pull.MailParticipants(); err != nil {
|
||||||
log.Error(4, "MailParticipants: %v", err)
|
log.Error(4, "MailParticipants: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPullRequestAction adds new action for merging pull request.
|
// UpdatePullRequestAction adds new action for updating or merging a pull request.
|
||||||
func NewPullRequestAction(actUser *User, repo *Repository, pull *Issue, commits *PushCommits) error {
|
func UpdatePullRequestAction(doer *User, repo *Repository, pull *Issue, commits *PushCommits) error {
|
||||||
if err := UpdateIssuesCommit(actUser, repo, commits.Commits, false); err != nil {
|
if err := UpdateIssuesCommit(doer, repo, commits.Commits, false); err != nil {
|
||||||
log.Error(4, "updateIssuesCommit: %v", err)
|
log.Error(4, "UpdateIssuesCommit: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return newPullRequestAction(x, actUser, repo, pull, commits)
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetFeedsOptions options for retrieving feeds
|
// GetFeedsOptions options for retrieving feeds
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user