diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2022-03-22 08:03:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-22 15:03:22 +0800 |
commit | 80fd25524e13dedbdc3527b32d008de152213a89 (patch) | |
tree | 63b2bfe4ffaf1dce12080cabdc2e845c8731a673 /routers/api/v1/repo/file.go | |
parent | 5495ba7660979973ba19e304786135da474e0e64 (diff) | |
download | gitea-80fd25524e13dedbdc3527b32d008de152213a89.tar.gz gitea-80fd25524e13dedbdc3527b32d008de152213a89.zip |
Renamed ctx.User to ctx.Doer. (#19161)
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'routers/api/v1/repo/file.go')
-rw-r--r-- | routers/api/v1/repo/file.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/routers/api/v1/repo/file.go b/routers/api/v1/repo/file.go index a27e383bc3..37781f79c9 100644 --- a/routers/api/v1/repo/file.go +++ b/routers/api/v1/repo/file.go @@ -391,7 +391,7 @@ func handleCreateOrUpdateFileError(ctx *context.APIContext, err error) { func createOrUpdateFile(ctx *context.APIContext, opts *files_service.UpdateRepoFileOptions) (*api.FileResponse, error) { if !canWriteFiles(ctx.Repo) { return nil, models.ErrUserDoesNotHaveAccessToRepo{ - UserID: ctx.User.ID, + UserID: ctx.Doer.ID, RepoName: ctx.Repo.Repository.LowerName, } } @@ -402,7 +402,7 @@ func createOrUpdateFile(ctx *context.APIContext, opts *files_service.UpdateRepoF } opts.Content = string(content) - return files_service.CreateOrUpdateRepoFile(ctx, ctx.Repo.Repository, ctx.User, opts) + return files_service.CreateOrUpdateRepoFile(ctx, ctx.Repo.Repository, ctx.Doer, opts) } // DeleteFile Delete a file in a repository @@ -448,7 +448,7 @@ func DeleteFile(ctx *context.APIContext) { apiOpts := web.GetForm(ctx).(*api.DeleteFileOptions) if !canWriteFiles(ctx.Repo) { ctx.Error(http.StatusForbidden, "DeleteFile", models.ErrUserDoesNotHaveAccessToRepo{ - UserID: ctx.User.ID, + UserID: ctx.Doer.ID, RepoName: ctx.Repo.Repository.LowerName, }) return @@ -489,7 +489,7 @@ func DeleteFile(ctx *context.APIContext) { opts.Message = ctx.Tr("repo.editor.delete", opts.TreePath) } - if fileResponse, err := files_service.DeleteRepoFile(ctx, ctx.Repo.Repository, ctx.User, opts); err != nil { + if fileResponse, err := files_service.DeleteRepoFile(ctx, ctx.Repo.Repository, ctx.Doer, opts); err != nil { if git.IsErrBranchNotExist(err) || models.IsErrRepoFileDoesNotExist(err) || git.IsErrNotExist(err) { ctx.Error(http.StatusNotFound, "DeleteFile", err) return @@ -546,7 +546,7 @@ func GetContents(ctx *context.APIContext) { if !canReadFiles(ctx.Repo) { ctx.Error(http.StatusInternalServerError, "GetContentsOrList", models.ErrUserDoesNotHaveAccessToRepo{ - UserID: ctx.User.ID, + UserID: ctx.Doer.ID, RepoName: ctx.Repo.Repository.LowerName, }) return |