diff options
Diffstat (limited to 'routers/web/repo/view.go')
-rw-r--r-- | routers/web/repo/view.go | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index 48565cb62b..01bd2d8923 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -22,6 +22,7 @@ import ( "code.gitea.io/gitea/models" asymkey_model "code.gitea.io/gitea/models/asymkey" "code.gitea.io/gitea/models/db" + git_model "code.gitea.io/gitea/models/git" repo_model "code.gitea.io/gitea/models/repo" unit_model "code.gitea.io/gitea/models/unit" user_model "code.gitea.io/gitea/models/user" @@ -294,8 +295,8 @@ func renderReadmeFile(ctx *context.Context, readmeFile *namedBlob, readmeTreelin if isTextFile && setting.LFS.StartServer { pointer, _ := lfs.ReadPointerFromBuffer(buf) if pointer.IsValid() { - meta, err := models.GetLFSMetaObjectByOid(ctx.Repo.Repository.ID, pointer.Oid) - if err != nil && err != models.ErrLFSObjectNotExist { + meta, err := git_model.GetLFSMetaObjectByOid(ctx.Repo.Repository.ID, pointer.Oid) + if err != nil && err != git_model.ErrLFSObjectNotExist { ctx.ServerError("GetLFSMetaObject", err) return } @@ -417,8 +418,8 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st if isTextFile && setting.LFS.StartServer { pointer, _ := lfs.ReadPointerFromBuffer(buf) if pointer.IsValid() { - meta, err := models.GetLFSMetaObjectByOid(ctx.Repo.Repository.ID, pointer.Oid) - if err != nil && err != models.ErrLFSObjectNotExist { + meta, err := git_model.GetLFSMetaObjectByOid(ctx.Repo.Repository.ID, pointer.Oid) + if err != nil && err != git_model.ErrLFSObjectNotExist { ctx.ServerError("GetLFSMetaObject", err) return } @@ -466,7 +467,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st ctx.Data["IsTextSource"] = isTextFile || isDisplayingSource // Check LFS Lock - lfsLock, err := models.GetTreePathLock(ctx.Repo.Repository.ID, ctx.Repo.TreePath) + lfsLock, err := git_model.GetTreePathLock(ctx.Repo.Repository.ID, ctx.Repo.TreePath) ctx.Data["LFSLock"] = lfsLock if err != nil { ctx.ServerError("GetTreePathLock", err) @@ -842,7 +843,7 @@ func renderDirectoryFiles(ctx *context.Context, timeout time.Duration) git.Entri verification := asymkey_model.ParseCommitWithSignature(latestCommit) if err := asymkey_model.CalculateTrustStatus(verification, ctx.Repo.Repository.GetTrustModel(), func(user *user_model.User) (bool, error) { - return models.IsOwnerMemberCollaborator(ctx.Repo.Repository, user.ID) + return repo_model.IsOwnerMemberCollaborator(ctx.Repo.Repository, user.ID) }, nil); err != nil { ctx.ServerError("CalculateTrustStatus", err) return nil @@ -851,12 +852,12 @@ func renderDirectoryFiles(ctx *context.Context, timeout time.Duration) git.Entri ctx.Data["LatestCommitUser"] = user_model.ValidateCommitWithEmail(latestCommit) } - statuses, _, err := models.GetLatestCommitStatus(ctx, ctx.Repo.Repository.ID, ctx.Repo.Commit.ID.String(), db.ListOptions{}) + statuses, _, err := git_model.GetLatestCommitStatus(ctx, ctx.Repo.Repository.ID, ctx.Repo.Commit.ID.String(), db.ListOptions{}) if err != nil { log.Error("GetLatestCommitStatus: %v", err) } - ctx.Data["LatestCommitStatus"] = models.CalcCommitStatus(statuses) + ctx.Data["LatestCommitStatus"] = git_model.CalcCommitStatus(statuses) ctx.Data["LatestCommitStatuses"] = statuses branchLink := ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchNameSubURL() @@ -991,12 +992,12 @@ func RenderUserCards(ctx *context.Context, total int, getter func(opts db.ListOp if page <= 0 { page = 1 } - pager := context.NewPagination(total, models.ItemsPerPage, page, 5) + pager := context.NewPagination(total, setting.ItemsPerPage, page, 5) ctx.Data["Page"] = pager items, err := getter(db.ListOptions{ Page: pager.Paginater.Current(), - PageSize: models.ItemsPerPage, + PageSize: setting.ItemsPerPage, }) if err != nil { ctx.ServerError("getter", err) @@ -1037,12 +1038,12 @@ func Forks(ctx *context.Context) { page = 1 } - pager := context.NewPagination(ctx.Repo.Repository.NumForks, models.ItemsPerPage, page, 5) + pager := context.NewPagination(ctx.Repo.Repository.NumForks, setting.ItemsPerPage, page, 5) ctx.Data["Page"] = pager forks, err := repo_model.GetForks(ctx.Repo.Repository, db.ListOptions{ Page: pager.Paginater.Current(), - PageSize: models.ItemsPerPage, + PageSize: setting.ItemsPerPage, }) if err != nil { ctx.ServerError("GetForks", err) |