mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Move issues related files into models/issues (#19931)
* Move access and repo permission to models/perm/access * fix test * fix git test * Move functions sequence * Some improvements per @KN4CK3R and @delvh * Move issues related code to models/issues * Move some issues related sub package * Merge * Fix test * Fix test * Fix test * Fix test * Rename some files
This commit is contained in:
		@@ -12,8 +12,8 @@ import (
 | 
			
		||||
	"sync"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"code.gitea.io/gitea/models"
 | 
			
		||||
	"code.gitea.io/gitea/models/db"
 | 
			
		||||
	issues_model "code.gitea.io/gitea/models/issues"
 | 
			
		||||
	repo_model "code.gitea.io/gitea/models/repo"
 | 
			
		||||
	"code.gitea.io/gitea/modules/graceful"
 | 
			
		||||
	"code.gitea.io/gitea/modules/log"
 | 
			
		||||
@@ -320,7 +320,7 @@ func populateIssueIndexer(ctx context.Context) {
 | 
			
		||||
 | 
			
		||||
// UpdateRepoIndexer add/update all issues of the repositories
 | 
			
		||||
func UpdateRepoIndexer(repo *repo_model.Repository) {
 | 
			
		||||
	is, err := models.Issues(&models.IssuesOptions{
 | 
			
		||||
	is, err := issues_model.Issues(&issues_model.IssuesOptions{
 | 
			
		||||
		RepoID:   repo.ID,
 | 
			
		||||
		IsClosed: util.OptionalBoolNone,
 | 
			
		||||
		IsPull:   util.OptionalBoolNone,
 | 
			
		||||
@@ -329,7 +329,7 @@ func UpdateRepoIndexer(repo *repo_model.Repository) {
 | 
			
		||||
		log.Error("Issues: %v", err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if err = models.IssueList(is).LoadDiscussComments(); err != nil {
 | 
			
		||||
	if err = issues_model.IssueList(is).LoadDiscussComments(); err != nil {
 | 
			
		||||
		log.Error("LoadComments: %v", err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
@@ -339,10 +339,10 @@ func UpdateRepoIndexer(repo *repo_model.Repository) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UpdateIssueIndexer add/update an issue to the issue indexer
 | 
			
		||||
func UpdateIssueIndexer(issue *models.Issue) {
 | 
			
		||||
func UpdateIssueIndexer(issue *issues_model.Issue) {
 | 
			
		||||
	var comments []string
 | 
			
		||||
	for _, comment := range issue.Comments {
 | 
			
		||||
		if comment.Type == models.CommentTypeComment {
 | 
			
		||||
		if comment.Type == issues_model.CommentTypeComment {
 | 
			
		||||
			comments = append(comments, comment.Content)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -362,7 +362,7 @@ func UpdateIssueIndexer(issue *models.Issue) {
 | 
			
		||||
// DeleteRepoIssueIndexer deletes repo's all issues indexes
 | 
			
		||||
func DeleteRepoIssueIndexer(repo *repo_model.Repository) {
 | 
			
		||||
	var ids []int64
 | 
			
		||||
	ids, err := models.GetIssueIDsByRepoID(db.DefaultContext, repo.ID)
 | 
			
		||||
	ids, err := issues_model.GetIssueIDsByRepoID(db.DefaultContext, repo.ID)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Error("getIssueIDsByRepoID failed: %v", err)
 | 
			
		||||
		return
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user