summaryrefslogtreecommitdiffstats
path: root/modules/notification
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2023-01-25 05:47:53 +0100
committerGitHub <noreply@github.com>2023-01-24 23:47:53 -0500
commitc8139c0f642a308b544d2f17e7b728ee6762a0eb (patch)
tree0b29563e5a3fe8511e18a1eb6f2cfdf2453fc88a /modules/notification
parenta31fedd2c2def13e29a962c751c449491d5a1588 (diff)
downloadgitea-c8139c0f642a308b544d2f17e7b728ee6762a0eb.tar.gz
gitea-c8139c0f642a308b544d2f17e7b728ee6762a0eb.zip
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.
Diffstat (limited to 'modules/notification')
-rw-r--r--modules/notification/action/action.go2
-rw-r--r--modules/notification/base/notifier.go2
-rw-r--r--modules/notification/base/null.go2
-rw-r--r--modules/notification/mail/mail.go2
-rw-r--r--modules/notification/notification.go4
-rw-r--r--modules/notification/ui/ui.go2
6 files changed, 7 insertions, 7 deletions
diff --git a/modules/notification/action/action.go b/modules/notification/action/action.go
index 2f882c2cb8..c043ef62d5 100644
--- a/modules/notification/action/action.go
+++ b/modules/notification/action/action.go
@@ -56,7 +56,7 @@ func (a *actionNotifier) NotifyNewIssue(ctx context.Context, issue *issues_model
}
// NotifyIssueChangeStatus notifies close or reopen issue to notifiers
-func (a *actionNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, closeOrReopen bool) {
+func (a *actionNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, commitID string, issue *issues_model.Issue, actionComment *issues_model.Comment, closeOrReopen bool) {
// Compose comment action, could be plain comment, close or reopen issue/pull request.
// This object will be used to notify watchers in the end of function.
act := &activities_model.Action{
diff --git a/modules/notification/base/notifier.go b/modules/notification/base/notifier.go
index dbed20ba3a..4021bbe141 100644
--- a/modules/notification/base/notifier.go
+++ b/modules/notification/base/notifier.go
@@ -23,7 +23,7 @@ type Notifier interface {
NotifyRenameRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, oldRepoName string)
NotifyTransferRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, oldOwnerName string)
NotifyNewIssue(ctx context.Context, issue *issues_model.Issue, mentions []*user_model.User)
- NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, closeOrReopen bool)
+ NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, commitID string, issue *issues_model.Issue, actionComment *issues_model.Comment, closeOrReopen bool)
NotifyDeleteIssue(ctx context.Context, doer *user_model.User, issue *issues_model.Issue)
NotifyIssueChangeMilestone(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldMilestoneID int64)
NotifyIssueChangeAssignee(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, assignee *user_model.User, removed bool, comment *issues_model.Comment)
diff --git a/modules/notification/base/null.go b/modules/notification/base/null.go
index de5f072d24..161eadfbec 100644
--- a/modules/notification/base/null.go
+++ b/modules/notification/base/null.go
@@ -32,7 +32,7 @@ func (*NullNotifier) NotifyNewIssue(ctx context.Context, issue *issues_model.Iss
}
// NotifyIssueChangeStatus places a place holder function
-func (*NullNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, isClosed bool) {
+func (*NullNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, commitID string, issue *issues_model.Issue, actionComment *issues_model.Comment, isClosed bool) {
}
// NotifyDeleteIssue notify when some issue deleted
diff --git a/modules/notification/mail/mail.go b/modules/notification/mail/mail.go
index 18f7fa22ae..7e54df44c4 100644
--- a/modules/notification/mail/mail.go
+++ b/modules/notification/mail/mail.go
@@ -54,7 +54,7 @@ func (m *mailNotifier) NotifyNewIssue(ctx context.Context, issue *issues_model.I
}
}
-func (m *mailNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, isClosed bool) {
+func (m *mailNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, commitID string, issue *issues_model.Issue, actionComment *issues_model.Comment, isClosed bool) {
var actionType activities_model.ActionType
if issue.IsPull {
if isClosed {
diff --git a/modules/notification/notification.go b/modules/notification/notification.go
index 10581eb87f..2300b68f78 100644
--- a/modules/notification/notification.go
+++ b/modules/notification/notification.go
@@ -77,9 +77,9 @@ func NotifyNewIssue(ctx context.Context, issue *issues_model.Issue, mentions []*
}
// NotifyIssueChangeStatus notifies close or reopen issue to notifiers
-func NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, closeOrReopen bool) {
+func NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, commitID string, issue *issues_model.Issue, actionComment *issues_model.Comment, closeOrReopen bool) {
for _, notifier := range notifiers {
- notifier.NotifyIssueChangeStatus(ctx, doer, issue, actionComment, closeOrReopen)
+ notifier.NotifyIssueChangeStatus(ctx, doer, commitID, issue, actionComment, closeOrReopen)
}
}
diff --git a/modules/notification/ui/ui.go b/modules/notification/ui/ui.go
index bc66c3d5a3..4b85f17b6c 100644
--- a/modules/notification/ui/ui.go
+++ b/modules/notification/ui/ui.go
@@ -93,7 +93,7 @@ func (ns *notificationService) NotifyNewIssue(ctx context.Context, issue *issues
}
}
-func (ns *notificationService) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, isClosed bool) {
+func (ns *notificationService) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, commitID string, issue *issues_model.Issue, actionComment *issues_model.Comment, isClosed bool) {
_ = ns.issueQueue.Push(issueNotificationOpts{
IssueID: issue.ID,
NotificationAuthorID: doer.ID,