diff --git a/modules/notification/base/notifier.go b/modules/notification/base/notifier.go index 1c607ded3..83773ca0b 100644 --- a/modules/notification/base/notifier.go +++ b/modules/notification/base/notifier.go @@ -27,6 +27,7 @@ type Notifier interface { NotifyIssueChangeContent(doer *models.User, issue *models.Issue, oldContent string) NotifyIssueClearLabels(doer *models.User, issue *models.Issue) NotifyIssueChangeTitle(doer *models.User, issue *models.Issue, oldTitle string) + NotifyIssueChangeRef(doer *models.User, issue *models.Issue, oldRef string) NotifyIssueChangeLabels(doer *models.User, issue *models.Issue, addedLabels []*models.Label, removedLabels []*models.Label) diff --git a/modules/notification/base/null.go b/modules/notification/base/null.go index f6c423b46..3a2f06aa9 100644 --- a/modules/notification/base/null.go +++ b/modules/notification/base/null.go @@ -94,6 +94,10 @@ func (*NullNotifier) NotifyIssueClearLabels(doer *models.User, issue *models.Iss func (*NullNotifier) NotifyIssueChangeTitle(doer *models.User, issue *models.Issue, oldTitle string) { } +// NotifyIssueChangeRef places a place holder function +func (*NullNotifier) NotifyIssueChangeRef(doer *models.User, issue *models.Issue, oldTitle string) { +} + // NotifyIssueChangeLabels places a place holder function func (*NullNotifier) NotifyIssueChangeLabels(doer *models.User, issue *models.Issue, addedLabels []*models.Label, removedLabels []*models.Label) { diff --git a/modules/notification/indexer/indexer.go b/modules/notification/indexer/indexer.go index 4bce99073..e7eb04051 100644 --- a/modules/notification/indexer/indexer.go +++ b/modules/notification/indexer/indexer.go @@ -132,3 +132,7 @@ func (r *indexerNotifier) NotifyIssueChangeContent(doer *models.User, issue *mod func (r *indexerNotifier) NotifyIssueChangeTitle(doer *models.User, issue *models.Issue, oldTitle string) { issue_indexer.UpdateIssueIndexer(issue) } + +func (r *indexerNotifier) NotifyIssueChangeRef(doer *models.User, issue *models.Issue, oldRef string) { + issue_indexer.UpdateIssueIndexer(issue) +} diff --git a/modules/notification/notification.go b/modules/notification/notification.go index 8c5d7d603..1956afdf9 100644 --- a/modules/notification/notification.go +++ b/modules/notification/notification.go @@ -164,6 +164,13 @@ func NotifyIssueChangeTitle(doer *models.User, issue *models.Issue, oldTitle str } } +// NotifyIssueChangeRef notifies change reference to notifiers +func NotifyIssueChangeRef(doer *models.User, issue *models.Issue, oldRef string) { + for _, notifier := range notifiers { + notifier.NotifyIssueChangeRef(doer, issue, oldRef) + } +} + // NotifyIssueChangeLabels notifies change labels to notifiers func NotifyIssueChangeLabels(doer *models.User, issue *models.Issue, addedLabels []*models.Label, removedLabels []*models.Label) { diff --git a/services/issue/issue.go b/services/issue/issue.go index d651a892e..dc0596f22 100644 --- a/services/issue/issue.go +++ b/services/issue/issue.go @@ -48,8 +48,8 @@ func ChangeIssueRef(issue *models.Issue, doer *models.User, ref string) (err err if err = issue.ChangeRef(doer, oldRef); err != nil { return } - // TODO: implement notifications - //notification.NotifyIssueChangeTitle(doer, issue, oldRef) + + notification.NotifyIssueChangeRef(doer, issue, oldRef) return nil }