diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-12-13 05:46:43 +0800 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2019-12-12 23:46:43 +0200 |
commit | ba1acf5b50739a37014ea1a9bf502019c7562b27 (patch) | |
tree | 778186f8a0fc0a5ebdea5c08a370d1f7595ac228 /modules | |
parent | dc2fe9801f1a83a5810a778b806dac1bc210f110 (diff) | |
download | gitea-ba1acf5b50739a37014ea1a9bf502019c7562b27.tar.gz gitea-ba1acf5b50739a37014ea1a9bf502019c7562b27.zip |
fix issue indexer not triggered when migrating a repository (#9332)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/indexer/issues/indexer.go | 37 | ||||
-rw-r--r-- | modules/notification/indexer/indexer.go | 1 |
2 files changed, 22 insertions, 16 deletions
diff --git a/modules/indexer/issues/indexer.go b/modules/indexer/issues/indexer.go index f4771136be..78eba58095 100644 --- a/modules/indexer/issues/indexer.go +++ b/modules/indexer/issues/indexer.go @@ -204,26 +204,31 @@ func populateIssueIndexer() { } for _, repo := range repos { - is, err := models.Issues(&models.IssuesOptions{ - RepoIDs: []int64{repo.ID}, - IsClosed: util.OptionalBoolNone, - IsPull: util.OptionalBoolNone, - }) - if err != nil { - log.Error("Issues: %v", err) - continue - } - if err = models.IssueList(is).LoadDiscussComments(); err != nil { - log.Error("LoadComments: %v", err) - continue - } - for _, issue := range is { - UpdateIssueIndexer(issue) - } + UpdateRepoIndexer(repo) } } } +// UpdateRepoIndexer add/update all issues of the repositories +func UpdateRepoIndexer(repo *models.Repository) { + is, err := models.Issues(&models.IssuesOptions{ + RepoIDs: []int64{repo.ID}, + IsClosed: util.OptionalBoolNone, + IsPull: util.OptionalBoolNone, + }) + if err != nil { + log.Error("Issues: %v", err) + return + } + if err = models.IssueList(is).LoadDiscussComments(); err != nil { + log.Error("LoadComments: %v", err) + return + } + for _, issue := range is { + UpdateIssueIndexer(issue) + } +} + // UpdateIssueIndexer add/update an issue to the issue indexer func UpdateIssueIndexer(issue *models.Issue) { var comments []string diff --git a/modules/notification/indexer/indexer.go b/modules/notification/indexer/indexer.go index 0e76dde539..4ca5e64c3e 100644 --- a/modules/notification/indexer/indexer.go +++ b/modules/notification/indexer/indexer.go @@ -111,6 +111,7 @@ func (r *indexerNotifier) NotifyDeleteRepository(doer *models.User, repo *models } func (r *indexerNotifier) NotifyMigrateRepository(doer *models.User, u *models.User, repo *models.Repository) { + issue_indexer.UpdateRepoIndexer(repo) if setting.Indexer.RepoIndexerEnabled && !repo.IsEmpty { code_indexer.UpdateRepoIndexer(repo) } |