diff options
Diffstat (limited to 'services')
-rw-r--r-- | services/indexer/notify.go | 9 | ||||
-rw-r--r-- | services/notify/notifier.go | 2 | ||||
-rw-r--r-- | services/notify/notify.go | 7 | ||||
-rw-r--r-- | services/notify/null.go | 4 |
4 files changed, 22 insertions, 0 deletions
diff --git a/services/indexer/notify.go b/services/indexer/notify.go index 22306c691b..a07bf38b06 100644 --- a/services/indexer/notify.go +++ b/services/indexer/notify.go @@ -110,6 +110,15 @@ func (r *indexerNotifier) SyncPushCommits(ctx context.Context, pusher *user_mode } } +func (r *indexerNotifier) ChangeDefaultBranch(ctx context.Context, repo *repo_model.Repository) { + if setting.Indexer.RepoIndexerEnabled && !repo.IsEmpty { + code_indexer.UpdateRepoIndexer(repo) + } + if err := stats_indexer.UpdateRepoIndexer(repo); err != nil { + log.Error("stats_indexer.UpdateRepoIndexer(%d) failed: %v", repo.ID, err) + } +} + func (r *indexerNotifier) IssueChangeContent(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldContent string) { issue_indexer.UpdateIssueIndexer(issue.ID) } diff --git a/services/notify/notifier.go b/services/notify/notifier.go index d1dbe44c11..ed053a812a 100644 --- a/services/notify/notifier.go +++ b/services/notify/notifier.go @@ -72,4 +72,6 @@ type Notifier interface { PackageCreate(ctx context.Context, doer *user_model.User, pd *packages_model.PackageDescriptor) PackageDelete(ctx context.Context, doer *user_model.User, pd *packages_model.PackageDescriptor) + + ChangeDefaultBranch(ctx context.Context, repo *repo_model.Repository) } diff --git a/services/notify/notify.go b/services/notify/notify.go index 71bc1c7d58..16fbb6325d 100644 --- a/services/notify/notify.go +++ b/services/notify/notify.go @@ -360,3 +360,10 @@ func PackageDelete(ctx context.Context, doer *user_model.User, pd *packages_mode notifier.PackageDelete(ctx, doer, pd) } } + +// ChangeDefaultBranch notifies change default branch to notifiers +func ChangeDefaultBranch(ctx context.Context, repo *repo_model.Repository) { + for _, notifier := range notifiers { + notifier.ChangeDefaultBranch(ctx, repo) + } +} diff --git a/services/notify/null.go b/services/notify/null.go index c5b31f83d6..dddd421bef 100644 --- a/services/notify/null.go +++ b/services/notify/null.go @@ -204,3 +204,7 @@ func (*NullNotifier) PackageCreate(ctx context.Context, doer *user_model.User, p // PackageDelete places a place holder function func (*NullNotifier) PackageDelete(ctx context.Context, doer *user_model.User, pd *packages_model.PackageDescriptor) { } + +// ChangeDefaultBranch places a place holder function +func (*NullNotifier) ChangeDefaultBranch(ctx context.Context, repo *repo_model.Repository) { +} |