From 8ab35eefc4ff5db3f2f0a62f6f0272eae9be0585 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 24 Nov 2019 13:16:59 +0800 Subject: Move mirror sync actions to notification (#9022) * Move mirror sync actions to notification * fix lint --- modules/notification/notification.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'modules/notification/notification.go') diff --git a/modules/notification/notification.go b/modules/notification/notification.go index fa0b280e71..71d6e79e6d 100644 --- a/modules/notification/notification.go +++ b/modules/notification/notification.go @@ -227,3 +227,24 @@ func NotifyDeleteRef(pusher *models.User, repo *models.Repository, refType, refF notifier.NotifyDeleteRef(pusher, repo, refType, refFullName) } } + +// NotifySyncPushCommits notifies commits pushed to notifiers +func NotifySyncPushCommits(pusher *models.User, repo *models.Repository, refName, oldCommitID, newCommitID string, commits *models.PushCommits) { + for _, notifier := range notifiers { + notifier.NotifySyncPushCommits(pusher, repo, refName, oldCommitID, newCommitID, commits) + } +} + +// NotifySyncCreateRef notifies branch or tag creation to notifiers +func NotifySyncCreateRef(pusher *models.User, repo *models.Repository, refType, refFullName string) { + for _, notifier := range notifiers { + notifier.NotifySyncCreateRef(pusher, repo, refType, refFullName) + } +} + +// NotifySyncDeleteRef notifies branch or tag deletion to notifiers +func NotifySyncDeleteRef(pusher *models.User, repo *models.Repository, refType, refFullName string) { + for _, notifier := range notifiers { + notifier.NotifySyncDeleteRef(pusher, repo, refType, refFullName) + } +} -- cgit v1.2.3