aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/file.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/repo/file.go')
-rw-r--r--routers/api/v1/repo/file.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/routers/api/v1/repo/file.go b/routers/api/v1/repo/file.go
index d9451b8090..009b8a26d6 100644
--- a/routers/api/v1/repo/file.go
+++ b/routers/api/v1/repo/file.go
@@ -12,6 +12,7 @@ import (
"time"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/models/unit"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/repofiles"
@@ -182,12 +183,12 @@ func GetEditorconfig(ctx *context.APIContext) {
// canWriteFiles returns true if repository is editable and user has proper access level.
func canWriteFiles(r *context.Repository) bool {
- return r.Permission.CanWrite(models.UnitTypeCode) && !r.Repository.IsMirror && !r.Repository.IsArchived
+ return r.Permission.CanWrite(unit.TypeCode) && !r.Repository.IsMirror && !r.Repository.IsArchived
}
// canReadFiles returns true if repository is readable and user has proper access level.
func canReadFiles(r *context.Repository) bool {
- return r.Permission.CanRead(models.UnitTypeCode)
+ return r.Permission.CanRead(unit.TypeCode)
}
// CreateFile handles API call for creating a file