mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-28 12:00:01 +02:00
Move repository model into models/repo (#17933)
* Some refactors related repository model * Move more methods out of repository * Move repository into models/repo * Fix test * Fix test * some improvements * Remove unnecessary function
This commit is contained in:
parent
fb8166c6c6
commit
719bddcd76
301 changed files with 3193 additions and 2919 deletions
|
@ -12,6 +12,7 @@ import (
|
|||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/models/perm"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
|
@ -29,7 +30,7 @@ func ProtectedBranch(ctx *context.Context) {
|
|||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||
ctx.Data["PageIsSettingsBranches"] = true
|
||||
|
||||
protectedBranches, err := ctx.Repo.Repository.GetProtectedBranches()
|
||||
protectedBranches, err := models.GetProtectedBranches(ctx.Repo.Repository.ID)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetProtectedBranches", err)
|
||||
return
|
||||
|
@ -82,7 +83,7 @@ func ProtectedBranchPost(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
}
|
||||
if err := repo.UpdateDefaultBranch(); err != nil {
|
||||
if err := repo_model.UpdateDefaultBranch(repo); err != nil {
|
||||
ctx.ServerError("SetDefaultBranch", err)
|
||||
return
|
||||
}
|
||||
|
@ -123,7 +124,7 @@ func SettingsProtectedBranch(c *context.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
users, err := c.Repo.Repository.GetReaders()
|
||||
users, err := models.GetRepoReaders(c.Repo.Repository)
|
||||
if err != nil {
|
||||
c.ServerError("Repo.Repository.GetReaders", err)
|
||||
return
|
||||
|
@ -279,7 +280,7 @@ func SettingsProtectedBranchPost(ctx *context.Context) {
|
|||
ctx.Redirect(fmt.Sprintf("%s/settings/branches/%s", ctx.Repo.RepoLink, util.PathEscapeSegments(branch)))
|
||||
} else {
|
||||
if protectBranch != nil {
|
||||
if err := ctx.Repo.Repository.DeleteProtectedBranch(protectBranch.ID); err != nil {
|
||||
if err := models.DeleteProtectedBranch(ctx.Repo.Repository.ID, protectBranch.ID); err != nil {
|
||||
ctx.ServerError("DeleteProtectedBranch", err)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue