forked from kevadesu/forgejo
Move some repository related code into sub package (#19711)
* Move some repository related code into sub package * Move more repository functions out of models * Fix lint * Some performance optimization for webhooks and others * some refactors * Fix lint * Fix * Update modules/repository/delete.go Co-authored-by: delvh <dev.lh@web.de> * Fix test * Merge * Fix test * Fix test * Fix test * Fix test Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
parent
ebeb6e7c71
commit
26095115f4
76 changed files with 1756 additions and 1674 deletions
|
@ -312,7 +312,7 @@ func GetReviewers(ctx *context.APIContext) {
|
|||
// "200":
|
||||
// "$ref": "#/responses/UserList"
|
||||
|
||||
reviewers, err := models.GetReviewers(ctx.Repo.Repository, ctx.Doer.ID, 0)
|
||||
reviewers, err := repo_model.GetReviewers(ctx, ctx.Repo.Repository, ctx.Doer.ID, 0)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "ListCollaborators", err)
|
||||
return
|
||||
|
@ -342,7 +342,7 @@ func GetAssignees(ctx *context.APIContext) {
|
|||
// "200":
|
||||
// "$ref": "#/responses/UserList"
|
||||
|
||||
assignees, err := models.GetRepoAssignees(ctx.Repo.Repository)
|
||||
assignees, err := repo_model.GetRepoAssignees(ctx, ctx.Repo.Repository)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "ListCollaborators", err)
|
||||
return
|
||||
|
|
|
@ -17,6 +17,7 @@ import (
|
|||
issues_model "code.gitea.io/gitea/models/issues"
|
||||
"code.gitea.io/gitea/models/organization"
|
||||
access_model "code.gitea.io/gitea/models/perm/access"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/models/unit"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
|
@ -130,7 +131,7 @@ func SearchIssues(ctx *context.APIContext) {
|
|||
}
|
||||
|
||||
// find repos user can access (for issue search)
|
||||
opts := &models.SearchRepoOptions{
|
||||
opts := &repo_model.SearchRepoOptions{
|
||||
Private: false,
|
||||
AllPublic: true,
|
||||
TopicOnly: false,
|
||||
|
@ -176,8 +177,8 @@ func SearchIssues(ctx *context.APIContext) {
|
|||
opts.TeamID = team.ID
|
||||
}
|
||||
|
||||
repoCond := models.SearchRepositoryCondition(opts)
|
||||
repoIDs, _, err := models.SearchRepositoryIDs(opts)
|
||||
repoCond := repo_model.SearchRepositoryCondition(opts)
|
||||
repoIDs, _, err := repo_model.SearchRepositoryIDs(opts)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "SearchRepositoryByName", err)
|
||||
return
|
||||
|
|
|
@ -123,7 +123,7 @@ func Search(ctx *context.APIContext) {
|
|||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
opts := &models.SearchRepoOptions{
|
||||
opts := &repo_model.SearchRepoOptions{
|
||||
ListOptions: utils.GetListOptions(ctx),
|
||||
Actor: ctx.Doer,
|
||||
Keyword: ctx.FormTrim("q"),
|
||||
|
@ -192,7 +192,7 @@ func Search(ctx *context.APIContext) {
|
|||
}
|
||||
|
||||
var err error
|
||||
repos, count, err := models.SearchRepository(opts)
|
||||
repos, count, err := repo_model.SearchRepository(opts)
|
||||
if err != nil {
|
||||
ctx.JSON(http.StatusInternalServerError, api.SearchError{
|
||||
OK: false,
|
||||
|
@ -344,7 +344,7 @@ func Generate(ctx *context.APIContext) {
|
|||
return
|
||||
}
|
||||
|
||||
opts := models.GenerateRepoOptions{
|
||||
opts := repo_module.GenerateRepoOptions{
|
||||
Name: form.Name,
|
||||
DefaultBranch: form.DefaultBranch,
|
||||
Description: form.Description,
|
||||
|
@ -717,7 +717,7 @@ func updateBasicProperties(ctx *context.APIContext, opts api.EditRepoOption) err
|
|||
repo.DefaultBranch = *opts.DefaultBranch
|
||||
}
|
||||
|
||||
if err := models.UpdateRepository(repo, visibilityChanged); err != nil {
|
||||
if err := repo_service.UpdateRepository(repo, visibilityChanged); err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "UpdateRepository", err)
|
||||
return err
|
||||
}
|
||||
|
@ -1036,7 +1036,7 @@ func Delete(ctx *context.APIContext) {
|
|||
owner := ctx.Repo.Owner
|
||||
repo := ctx.Repo.Repository
|
||||
|
||||
canDelete, err := models.CanUserDelete(repo, ctx.Doer)
|
||||
canDelete, err := repo_module.CanUserDelete(repo, ctx.Doer)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "CanUserDelete", err)
|
||||
return
|
||||
|
|
|
@ -7,9 +7,9 @@ package user
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/models/perm"
|
||||
access_model "code.gitea.io/gitea/models/perm/access"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/convert"
|
||||
|
@ -21,7 +21,7 @@ import (
|
|||
func listUserRepos(ctx *context.APIContext, u *user_model.User, private bool) {
|
||||
opts := utils.GetListOptions(ctx)
|
||||
|
||||
repos, count, err := models.GetUserRepositories(&models.SearchRepoOptions{
|
||||
repos, count, err := repo_model.GetUserRepositories(&repo_model.SearchRepoOptions{
|
||||
Actor: u,
|
||||
Private: private,
|
||||
ListOptions: opts,
|
||||
|
@ -103,7 +103,7 @@ func ListMyRepos(ctx *context.APIContext) {
|
|||
// "200":
|
||||
// "$ref": "#/responses/RepositoryList"
|
||||
|
||||
opts := &models.SearchRepoOptions{
|
||||
opts := &repo_model.SearchRepoOptions{
|
||||
ListOptions: utils.GetListOptions(ctx),
|
||||
Actor: ctx.Doer,
|
||||
OwnerID: ctx.Doer.ID,
|
||||
|
@ -112,7 +112,7 @@ func ListMyRepos(ctx *context.APIContext) {
|
|||
}
|
||||
|
||||
var err error
|
||||
repos, count, err := models.SearchRepository(opts)
|
||||
repos, count, err := repo_model.SearchRepository(opts)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "SearchRepository", err)
|
||||
return
|
||||
|
|
|
@ -55,7 +55,7 @@ func Code(ctx *context.Context) {
|
|||
|
||||
// guest user or non-admin user
|
||||
if ctx.Doer == nil || !isAdmin {
|
||||
repoIDs, err = models.FindUserAccessibleRepoIDs(ctx.Doer)
|
||||
repoIDs, err = repo_model.FindUserAccessibleRepoIDs(ctx.Doer)
|
||||
if err != nil {
|
||||
ctx.ServerError("SearchResults", err)
|
||||
return
|
||||
|
@ -79,7 +79,7 @@ func Code(ctx *context.Context) {
|
|||
rightRepoMap := make(map[int64]*repo_model.Repository, len(repoMaps))
|
||||
repoIDs = make([]int64, 0, len(repoMaps))
|
||||
for id, repo := range repoMaps {
|
||||
if models.CheckRepoUnitUser(repo, ctx.Doer, unit.TypeCode) {
|
||||
if models.CheckRepoUnitUser(ctx, repo, ctx.Doer, unit.TypeCode) {
|
||||
rightRepoMap[id] = repo
|
||||
repoIDs = append(repoIDs, id)
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ package explore
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/models/db"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
|
@ -81,7 +80,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
|
|||
language := ctx.FormTrim("language")
|
||||
ctx.Data["Language"] = language
|
||||
|
||||
repos, count, err = models.SearchRepository(&models.SearchRepoOptions{
|
||||
repos, count, err = repo_model.SearchRepository(&repo_model.SearchRepoOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
Page: page,
|
||||
PageSize: opts.PageSize,
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"net/http"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/organization"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
|
@ -105,7 +104,7 @@ func Home(ctx *context.Context) {
|
|||
count int64
|
||||
err error
|
||||
)
|
||||
repos, count, err = models.SearchRepository(&models.SearchRepoOptions{
|
||||
repos, count, err = repo_model.SearchRepository(&repo_model.SearchRepoOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: setting.UI.User.RepoPagingNum,
|
||||
Page: page,
|
||||
|
|
|
@ -24,6 +24,7 @@ import (
|
|||
user_setting "code.gitea.io/gitea/routers/web/user/setting"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
"code.gitea.io/gitea/services/org"
|
||||
repo_service "code.gitea.io/gitea/services/repository"
|
||||
user_service "code.gitea.io/gitea/services/user"
|
||||
)
|
||||
|
||||
|
@ -117,7 +118,7 @@ func SettingsPost(ctx *context.Context) {
|
|||
|
||||
// update forks visibility
|
||||
if visibilityChanged {
|
||||
repos, _, err := models.GetUserRepositories(&models.SearchRepoOptions{
|
||||
repos, _, err := repo_model.GetUserRepositories(&repo_model.SearchRepoOptions{
|
||||
Actor: org.AsUser(), Private: true, ListOptions: db.ListOptions{Page: 1, PageSize: org.NumRepos},
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -126,7 +127,7 @@ func SettingsPost(ctx *context.Context) {
|
|||
}
|
||||
for _, repo := range repos {
|
||||
repo.OwnerName = org.Name
|
||||
if err := models.UpdateRepository(repo, true); err != nil {
|
||||
if err := repo_service.UpdateRepository(repo, true); err != nil {
|
||||
ctx.ServerError("UpdateRepository", err)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
access_model "code.gitea.io/gitea/models/perm/access"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
|
@ -19,6 +18,7 @@ import (
|
|||
"code.gitea.io/gitea/modules/upload"
|
||||
"code.gitea.io/gitea/routers/common"
|
||||
"code.gitea.io/gitea/services/attachment"
|
||||
repo_service "code.gitea.io/gitea/services/repository"
|
||||
)
|
||||
|
||||
// UploadIssueAttachment response for Issue/PR attachments
|
||||
|
@ -95,7 +95,7 @@ func GetAttachment(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
repository, unitType, err := models.LinkedRepository(attach)
|
||||
repository, unitType, err := repo_service.LinkedRepository(attach)
|
||||
if err != nil {
|
||||
ctx.ServerError("LinkedRepository", err)
|
||||
return
|
||||
|
|
|
@ -457,7 +457,7 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo {
|
|||
if rootRepo != nil &&
|
||||
rootRepo.ID != ci.HeadRepo.ID &&
|
||||
rootRepo.ID != baseRepo.ID {
|
||||
canRead := models.CheckRepoUnitUser(rootRepo, ctx.Doer, unit.TypeCode)
|
||||
canRead := models.CheckRepoUnitUser(ctx, rootRepo, ctx.Doer, unit.TypeCode)
|
||||
if canRead {
|
||||
ctx.Data["RootRepo"] = rootRepo
|
||||
if !fileOnly {
|
||||
|
@ -482,7 +482,7 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo {
|
|||
ownForkRepo.ID != ci.HeadRepo.ID &&
|
||||
ownForkRepo.ID != baseRepo.ID &&
|
||||
(rootRepo == nil || ownForkRepo.ID != rootRepo.ID) {
|
||||
canRead := models.CheckRepoUnitUser(ownForkRepo, ctx.Doer, unit.TypeCode)
|
||||
canRead := models.CheckRepoUnitUser(ctx, ownForkRepo, ctx.Doer, unit.TypeCode)
|
||||
if canRead {
|
||||
ctx.Data["OwnForkRepo"] = ownForkRepo
|
||||
if !fileOnly {
|
||||
|
|
|
@ -49,6 +49,7 @@ import (
|
|||
"code.gitea.io/gitea/services/forms"
|
||||
issue_service "code.gitea.io/gitea/services/issue"
|
||||
pull_service "code.gitea.io/gitea/services/pull"
|
||||
repo_service "code.gitea.io/gitea/services/repository"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -283,7 +284,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
|
|||
ctx.Data["CommitStatuses"] = commitStatuses
|
||||
|
||||
// Get assignees.
|
||||
ctx.Data["Assignees"], err = models.GetRepoAssignees(repo)
|
||||
ctx.Data["Assignees"], err = repo_model.GetRepoAssignees(ctx, repo)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetAssignees", err)
|
||||
return
|
||||
|
@ -441,7 +442,7 @@ func RetrieveRepoMilestonesAndAssignees(ctx *context.Context, repo *repo_model.R
|
|||
return
|
||||
}
|
||||
|
||||
ctx.Data["Assignees"], err = models.GetRepoAssignees(repo)
|
||||
ctx.Data["Assignees"], err = repo_model.GetRepoAssignees(ctx, repo)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetAssignees", err)
|
||||
return
|
||||
|
@ -522,13 +523,13 @@ func RetrieveRepoReviewers(ctx *context.Context, repo *repo_model.Repository, is
|
|||
posterID = 0
|
||||
}
|
||||
|
||||
reviewers, err = models.GetReviewers(repo, ctx.Doer.ID, posterID)
|
||||
reviewers, err = repo_model.GetReviewers(ctx, repo, ctx.Doer.ID, posterID)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetReviewers", err)
|
||||
return
|
||||
}
|
||||
|
||||
teamReviewers, err = models.GetReviewerTeams(repo)
|
||||
teamReviewers, err = repo_service.GetReviewerTeams(repo)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetReviewerTeams", err)
|
||||
return
|
||||
|
@ -2160,7 +2161,7 @@ func SearchIssues(ctx *context.Context) {
|
|||
}
|
||||
|
||||
// find repos user can access (for issue search)
|
||||
opts := &models.SearchRepoOptions{
|
||||
opts := &repo_model.SearchRepoOptions{
|
||||
Private: false,
|
||||
AllPublic: true,
|
||||
TopicOnly: false,
|
||||
|
@ -2206,8 +2207,8 @@ func SearchIssues(ctx *context.Context) {
|
|||
opts.TeamID = team.ID
|
||||
}
|
||||
|
||||
repoCond := models.SearchRepositoryCondition(opts)
|
||||
repoIDs, _, err := models.SearchRepositoryIDs(opts)
|
||||
repoCond := repo_model.SearchRepositoryCondition(opts)
|
||||
repoIDs, _, err := repo_model.SearchRepositoryIDs(opts)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "SearchRepositoryByName", err.Error())
|
||||
return
|
||||
|
|
|
@ -758,7 +758,7 @@ func ViewPullFiles(ctx *context.Context) {
|
|||
setCompareContext(ctx, baseCommit, commit, ctx.Repo.Owner.Name, ctx.Repo.Repository.Name)
|
||||
|
||||
ctx.Data["RequireTribute"] = true
|
||||
if ctx.Data["Assignees"], err = models.GetRepoAssignees(ctx.Repo.Repository); err != nil {
|
||||
if ctx.Data["Assignees"], err = repo_model.GetRepoAssignees(ctx, ctx.Repo.Repository); err != nil {
|
||||
ctx.ServerError("GetAssignees", err)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ func Create(ctx *context.Context) {
|
|||
templateID := ctx.FormInt64("template_id")
|
||||
if templateID > 0 {
|
||||
templateRepo, err := repo_model.GetRepositoryByID(templateID)
|
||||
if err == nil && models.CheckRepoUnitUser(templateRepo, ctxUser, unit.TypeCode) {
|
||||
if err == nil && models.CheckRepoUnitUser(ctx, templateRepo, ctxUser, unit.TypeCode) {
|
||||
ctx.Data["repo_template"] = templateID
|
||||
ctx.Data["repo_template_name"] = templateRepo.Name
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ func CreatePost(ctx *context.Context) {
|
|||
var repo *repo_model.Repository
|
||||
var err error
|
||||
if form.RepoTemplate > 0 {
|
||||
opts := models.GenerateRepoOptions{
|
||||
opts := repo_module.GenerateRepoOptions{
|
||||
Name: form.RepoName,
|
||||
Description: form.Description,
|
||||
Private: form.Private,
|
||||
|
@ -304,7 +304,7 @@ func Action(ctx *context.Context) {
|
|||
|
||||
ctx.Repo.Repository.Description = ctx.FormString("desc")
|
||||
ctx.Repo.Repository.Website = ctx.FormString("site")
|
||||
err = models.UpdateRepository(ctx.Repo.Repository, false)
|
||||
err = repo_service.UpdateRepository(ctx.Repo.Repository, false)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
@ -509,7 +509,7 @@ func InitiateDownload(ctx *context.Context) {
|
|||
|
||||
// SearchRepo repositories via options
|
||||
func SearchRepo(ctx *context.Context) {
|
||||
opts := &models.SearchRepoOptions{
|
||||
opts := &repo_model.SearchRepoOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
Page: ctx.FormInt("page"),
|
||||
PageSize: convert.ToCorrectPageSize(ctx.FormInt("limit")),
|
||||
|
@ -581,7 +581,7 @@ func SearchRepo(ctx *context.Context) {
|
|||
}
|
||||
|
||||
var err error
|
||||
repos, count, err := models.SearchRepository(opts)
|
||||
repos, count, err := repo_model.SearchRepository(opts)
|
||||
if err != nil {
|
||||
ctx.JSON(http.StatusInternalServerError, api.SearchError{
|
||||
OK: false,
|
||||
|
|
|
@ -168,7 +168,7 @@ func SettingsPost(ctx *context.Context) {
|
|||
}
|
||||
|
||||
repo.IsPrivate = form.Private
|
||||
if err := models.UpdateRepository(repo, visibilityChanged); err != nil {
|
||||
if err := repo_service.UpdateRepository(repo, visibilityChanged); err != nil {
|
||||
ctx.ServerError("UpdateRepository", err)
|
||||
return
|
||||
}
|
||||
|
@ -491,7 +491,7 @@ func SettingsPost(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
if repoChanged {
|
||||
if err := models.UpdateRepository(repo, false); err != nil {
|
||||
if err := repo_service.UpdateRepository(repo, false); err != nil {
|
||||
ctx.ServerError("UpdateRepository", err)
|
||||
return
|
||||
}
|
||||
|
@ -510,7 +510,7 @@ func SettingsPost(ctx *context.Context) {
|
|||
}
|
||||
|
||||
if changed {
|
||||
if err := models.UpdateRepository(repo, false); err != nil {
|
||||
if err := repo_service.UpdateRepository(repo, false); err != nil {
|
||||
ctx.ServerError("UpdateRepository", err)
|
||||
return
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ func SettingsPost(ctx *context.Context) {
|
|||
repo.IsFsckEnabled = form.EnableHealthCheck
|
||||
}
|
||||
|
||||
if err := models.UpdateRepository(repo, false); err != nil {
|
||||
if err := repo_service.UpdateRepository(repo, false); err != nil {
|
||||
ctx.ServerError("UpdateRepository", err)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import (
|
|||
"code.gitea.io/gitea/modules/lfs"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/markup"
|
||||
repo_module "code.gitea.io/gitea/modules/repository"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/typesniffer"
|
||||
|
@ -905,7 +906,7 @@ func renderCode(ctx *context.Context) {
|
|||
ctx.ServerError("UpdateRepositoryCols", err)
|
||||
return
|
||||
}
|
||||
if err = models.UpdateRepoSize(ctx, ctx.Repo.Repository); err != nil {
|
||||
if err = repo_module.UpdateRepoSize(ctx, ctx.Repo.Repository); err != nil {
|
||||
ctx.ServerError("UpdateRepoSize", err)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ func Milestones(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
repoOpts := models.SearchRepoOptions{
|
||||
repoOpts := repo_model.SearchRepoOptions{
|
||||
Actor: ctxUser,
|
||||
OwnerID: ctxUser.ID,
|
||||
Private: true,
|
||||
|
@ -181,7 +181,7 @@ func Milestones(ctx *context.Context) {
|
|||
}
|
||||
|
||||
var (
|
||||
userRepoCond = models.SearchRepositoryCondition(&repoOpts) // all repo condition user could visit
|
||||
userRepoCond = repo_model.SearchRepositoryCondition(&repoOpts) // all repo condition user could visit
|
||||
repoCond = userRepoCond
|
||||
repoIDs []int64
|
||||
|
||||
|
@ -234,7 +234,7 @@ func Milestones(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
showRepos, _, err := models.SearchRepositoryByCondition(&repoOpts, userRepoCond, false)
|
||||
showRepos, _, err := repo_model.SearchRepositoryByCondition(&repoOpts, userRepoCond, false)
|
||||
if err != nil {
|
||||
ctx.ServerError("SearchRepositoryByCondition", err)
|
||||
return
|
||||
|
@ -437,7 +437,7 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
|
|||
// As team:
|
||||
// - Team org's owns the repository.
|
||||
// - Team has read permission to repository.
|
||||
repoOpts := &models.SearchRepoOptions{
|
||||
repoOpts := &repo_model.SearchRepoOptions{
|
||||
Actor: ctx.Doer,
|
||||
OwnerID: ctx.Doer.ID,
|
||||
Private: true,
|
||||
|
@ -559,7 +559,7 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
|
|||
}
|
||||
|
||||
// a RepositoryList
|
||||
showRepos := models.RepositoryListOfMap(showReposMap)
|
||||
showRepos := repo_model.RepositoryListOfMap(showReposMap)
|
||||
sort.Sort(showRepos)
|
||||
|
||||
// maps pull request IDs to their CommitStatus. Will be posted to ctx.Data.
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/test"
|
||||
|
@ -26,7 +26,7 @@ func TestArchivedIssues(t *testing.T) {
|
|||
ctx.Req.Form.Set("state", "open")
|
||||
|
||||
// Assume: User 30 has access to two Repos with Issues, one of the Repos being archived.
|
||||
repos, _, _ := models.GetUserRepositories(&models.SearchRepoOptions{Actor: ctx.Doer})
|
||||
repos, _, _ := repo_model.GetUserRepositories(&repo_model.SearchRepoOptions{Actor: ctx.Doer})
|
||||
assert.Len(t, repos, 2)
|
||||
IsArchived := make(map[int64]bool)
|
||||
NumIssues := make(map[int64]int)
|
||||
|
|
|
@ -7,7 +7,6 @@ package user
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/models/db"
|
||||
packages_model "code.gitea.io/gitea/models/packages"
|
||||
container_model "code.gitea.io/gitea/models/packages/container"
|
||||
|
@ -288,7 +287,7 @@ func PackageSettings(ctx *context.Context) {
|
|||
ctx.Data["ContextUser"] = ctx.ContextUser
|
||||
ctx.Data["PackageDescriptor"] = pd
|
||||
|
||||
repos, _, _ := models.GetUserRepositories(&models.SearchRepoOptions{
|
||||
repos, _, _ := repo_model.GetUserRepositories(&repo_model.SearchRepoOptions{
|
||||
Actor: pd.Owner,
|
||||
Private: true,
|
||||
})
|
||||
|
|
|
@ -195,7 +195,7 @@ func Profile(ctx *context.Context) {
|
|||
}
|
||||
case "stars":
|
||||
ctx.Data["PageIsProfileStarList"] = true
|
||||
repos, count, err = models.SearchRepository(&models.SearchRepoOptions{
|
||||
repos, count, err = repo_model.SearchRepository(&repo_model.SearchRepoOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: setting.UI.User.RepoPagingNum,
|
||||
Page: page,
|
||||
|
@ -227,7 +227,7 @@ func Profile(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
case "watching":
|
||||
repos, count, err = models.SearchRepository(&models.SearchRepoOptions{
|
||||
repos, count, err = repo_model.SearchRepository(&repo_model.SearchRepoOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: setting.UI.User.RepoPagingNum,
|
||||
Page: page,
|
||||
|
@ -249,7 +249,7 @@ func Profile(ctx *context.Context) {
|
|||
|
||||
total = int(count)
|
||||
default:
|
||||
repos, count, err = models.SearchRepository(&models.SearchRepoOptions{
|
||||
repos, count, err = repo_model.SearchRepository(&repo_model.SearchRepoOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: setting.UI.User.RepoPagingNum,
|
||||
Page: page,
|
||||
|
|
|
@ -15,7 +15,6 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/organization"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
|
@ -304,7 +303,7 @@ func Repos(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
userRepos, _, err := models.GetUserRepositories(&models.SearchRepoOptions{
|
||||
userRepos, _, err := repo_model.GetUserRepositories(&repo_model.SearchRepoOptions{
|
||||
Actor: ctxUser,
|
||||
Private: true,
|
||||
ListOptions: db.ListOptions{
|
||||
|
@ -329,7 +328,7 @@ func Repos(ctx *context.Context) {
|
|||
ctx.Data["Dirs"] = repoNames
|
||||
ctx.Data["ReposMap"] = repos
|
||||
} else {
|
||||
repos, count64, err := models.GetUserRepositories(&models.SearchRepoOptions{Actor: ctxUser, Private: true, ListOptions: opts})
|
||||
repos, count64, err := repo_model.GetUserRepositories(&repo_model.SearchRepoOptions{Actor: ctxUser, Private: true, ListOptions: opts})
|
||||
if err != nil {
|
||||
ctx.ServerError("GetUserRepositories", err)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue