1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-04 14:46:57 -05:00

fix issue indexer not triggered when migrating a repository (#9332)

This commit is contained in:
Lunny Xiao 2019-12-13 05:46:43 +08:00 committed by Lauris BH
parent dc2fe9801f
commit ba1acf5b50
2 changed files with 22 additions and 16 deletions

View File

@ -204,6 +204,13 @@ func populateIssueIndexer() {
}
for _, repo := range repos {
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,
@ -211,17 +218,15 @@ func populateIssueIndexer() {
})
if err != nil {
log.Error("Issues: %v", err)
continue
return
}
if err = models.IssueList(is).LoadDiscussComments(); err != nil {
log.Error("LoadComments: %v", err)
continue
return
}
for _, issue := range is {
UpdateIssueIndexer(issue)
}
}
}
}
// UpdateIssueIndexer add/update an issue to the issue indexer

View File

@ -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)
}