From 016a5d0438e551d4630819683dd6dc4fccb0cb51 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 9 Nov 2019 04:54:50 +0800 Subject: Move some actions to notification/action (#8779) * Move some actions to notification/action * Fix test * fix test --- modules/notification/action/action.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'modules/notification/action/action.go') diff --git a/modules/notification/action/action.go b/modules/notification/action/action.go index 15228f65e7..52471c1107 100644 --- a/modules/notification/action/action.go +++ b/modules/notification/action/action.go @@ -20,7 +20,7 @@ var ( _ base.Notifier = &actionNotifier{} ) -// NewNotifier create a new webhookNotifier notifier +// NewNotifier create a new actionNotifier notifier func NewNotifier() base.Notifier { return &actionNotifier{} } @@ -75,3 +75,19 @@ func (a *actionNotifier) NotifyNewPullRequest(pull *models.PullRequest) { log.Error("NotifyWatchers: %v", err) } } + +func (a *actionNotifier) NotifyRenameRepository(doer *models.User, repo *models.Repository, oldName string) { + if err := models.NotifyWatchers(&models.Action{ + ActUserID: doer.ID, + ActUser: doer, + OpType: models.ActionRenameRepo, + RepoID: repo.ID, + Repo: repo, + IsPrivate: repo.IsPrivate, + Content: oldName, + }); err != nil { + log.Error("notify watchers: %v", err) + } else { + log.Trace("action.renameRepoAction: %s/%s", doer.Name, repo.Name) + } +} -- cgit v1.2.3