forked from forgejo/forgejo
Webhooks: for issue close/reopen action, add commit ID that caused it (#22583)
The `commit_id` property name is the same as equivalent functionality in GitHub. If the action was not caused by a commit, an empty string is used. This can for example be used to automatically add a Resolved label to an issue fixed by a commit, or clear it when the issue is reopened.
This commit is contained in:
parent
a31fedd2c2
commit
c8139c0f64
15 changed files with 25 additions and 21 deletions
|
@ -14,13 +14,13 @@ import (
|
|||
)
|
||||
|
||||
// ChangeStatus changes issue status to open or closed.
|
||||
func ChangeStatus(issue *issues_model.Issue, doer *user_model.User, closed bool) error {
|
||||
return changeStatusCtx(db.DefaultContext, issue, doer, closed)
|
||||
func ChangeStatus(issue *issues_model.Issue, doer *user_model.User, commitID string, closed bool) error {
|
||||
return changeStatusCtx(db.DefaultContext, issue, doer, commitID, closed)
|
||||
}
|
||||
|
||||
// changeStatusCtx changes issue status to open or closed.
|
||||
// TODO: if context is not db.DefaultContext we get a deadlock!!!
|
||||
func changeStatusCtx(ctx context.Context, issue *issues_model.Issue, doer *user_model.User, closed bool) error {
|
||||
func changeStatusCtx(ctx context.Context, issue *issues_model.Issue, doer *user_model.User, commitID string, closed bool) error {
|
||||
comment, err := issues_model.ChangeIssueStatus(ctx, issue, doer, closed)
|
||||
if err != nil {
|
||||
if issues_model.IsErrDependenciesLeft(err) && closed {
|
||||
|
@ -37,7 +37,7 @@ func changeStatusCtx(ctx context.Context, issue *issues_model.Issue, doer *user_
|
|||
}
|
||||
}
|
||||
|
||||
notification.NotifyIssueChangeStatus(ctx, doer, issue, comment, closed)
|
||||
notification.NotifyIssueChangeStatus(ctx, doer, commitID, issue, comment, closed)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue