fix issue indexer not triggered when migrating a repository (#9333)
This commit is contained in:
parent
eb8d5f6aff
commit
1aeeaa8e89
2 changed files with 26 additions and 16 deletions
|
@ -138,6 +138,13 @@ func populateIssueIndexer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, repo := range repos {
|
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{
|
is, err := models.Issues(&models.IssuesOptions{
|
||||||
RepoIDs: []int64{repo.ID},
|
RepoIDs: []int64{repo.ID},
|
||||||
IsClosed: util.OptionalBoolNone,
|
IsClosed: util.OptionalBoolNone,
|
||||||
|
@ -145,18 +152,16 @@ func populateIssueIndexer() {
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Issues: %v", err)
|
log.Error("Issues: %v", err)
|
||||||
continue
|
return
|
||||||
}
|
}
|
||||||
if err = models.IssueList(is).LoadDiscussComments(); err != nil {
|
if err = models.IssueList(is).LoadDiscussComments(); err != nil {
|
||||||
log.Error("LoadComments: %v", err)
|
log.Error("LoadComments: %v", err)
|
||||||
continue
|
return
|
||||||
}
|
}
|
||||||
for _, issue := range is {
|
for _, issue := range is {
|
||||||
UpdateIssueIndexer(issue)
|
UpdateIssueIndexer(issue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateIssueIndexer add/update an issue to the issue indexer
|
// UpdateIssueIndexer add/update an issue to the issue indexer
|
||||||
func UpdateIssueIndexer(issue *models.Issue) {
|
func UpdateIssueIndexer(issue *models.Issue) {
|
||||||
|
|
|
@ -107,3 +107,8 @@ func (r *indexerNotifier) NotifyIssueChangeContent(doer *models.User, issue *mod
|
||||||
func (r *indexerNotifier) NotifyIssueChangeTitle(doer *models.User, issue *models.Issue, oldTitle string) {
|
func (r *indexerNotifier) NotifyIssueChangeTitle(doer *models.User, issue *models.Issue, oldTitle string) {
|
||||||
issue_indexer.UpdateIssueIndexer(issue)
|
issue_indexer.UpdateIssueIndexer(issue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *indexerNotifier) NotifyMigrateRepository(doer *models.User, u *models.User, repo *models.Repository) {
|
||||||
|
issue_indexer.UpdateRepoIndexer(repo)
|
||||||
|
models.UpdateRepoIndexer(repo)
|
||||||
|
}
|
||||||
|
|
Reference in a new issue