summaryrefslogtreecommitdiffstats
path: root/services/repository
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-06-13 17:37:59 +0800
committerGitHub <noreply@github.com>2022-06-13 17:37:59 +0800
commit1a9821f57a0293db3adc0eab8aff08ca5fa1026c (patch)
tree3c3d02813eb63c0d0827ef6d9745f6dcdd2636cb /services/repository
parent3708ca8e2849ca7e36e6bd15ec6935a2a2d81e55 (diff)
downloadgitea-1a9821f57a0293db3adc0eab8aff08ca5fa1026c.tar.gz
gitea-1a9821f57a0293db3adc0eab8aff08ca5fa1026c.zip
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
Diffstat (limited to 'services/repository')
-rw-r--r--services/repository/repository.go3
-rw-r--r--services/repository/template.go7
2 files changed, 6 insertions, 4 deletions
diff --git a/services/repository/repository.go b/services/repository/repository.go
index 6848eda101..4bde6879a6 100644
--- a/services/repository/repository.go
+++ b/services/repository/repository.go
@@ -11,6 +11,7 @@ import (
"code.gitea.io/gitea/models"
admin_model "code.gitea.io/gitea/models/admin"
"code.gitea.io/gitea/models/db"
+ issues_model "code.gitea.io/gitea/models/issues"
"code.gitea.io/gitea/models/organization"
packages_model "code.gitea.io/gitea/models/packages"
repo_model "code.gitea.io/gitea/models/repo"
@@ -105,7 +106,7 @@ func UpdateRepository(repo *repo_model.Repository, visibilityChanged bool) (err
// LinkedRepository returns the linked repo if any
func LinkedRepository(a *repo_model.Attachment) (*repo_model.Repository, unit.Type, error) {
if a.IssueID != 0 {
- iss, err := models.GetIssueByID(a.IssueID)
+ iss, err := issues_model.GetIssueByID(db.DefaultContext, a.IssueID)
if err != nil {
return nil, unit.TypeIssues, err
}
diff --git a/services/repository/template.go b/services/repository/template.go
index 6a1bfaff5b..d7e8145811 100644
--- a/services/repository/template.go
+++ b/services/repository/template.go
@@ -9,6 +9,7 @@ import (
"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"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/log"
@@ -18,14 +19,14 @@ import (
// GenerateIssueLabels generates issue labels from a template repository
func GenerateIssueLabels(ctx context.Context, templateRepo, generateRepo *repo_model.Repository) error {
- templateLabels, err := models.GetLabelsByRepoID(ctx, templateRepo.ID, "", db.ListOptions{})
+ templateLabels, err := issues_model.GetLabelsByRepoID(ctx, templateRepo.ID, "", db.ListOptions{})
if err != nil {
return err
}
- newLabels := make([]*models.Label, 0, len(templateLabels))
+ newLabels := make([]*issues_model.Label, 0, len(templateLabels))
for _, templateLabel := range templateLabels {
- newLabels = append(newLabels, &models.Label{
+ newLabels = append(newLabels, &issues_model.Label{
RepoID: generateRepo.ID,
Name: templateLabel.Name,
Description: templateLabel.Description,