1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-02 16:35:19 +02:00

Renamed ctx.User to ctx.Doer. (#19161)

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
KN4CK3R 2022-03-22 08:03:22 +01:00 committed by GitHub
parent 5495ba7660
commit 80fd25524e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
129 changed files with 881 additions and 881 deletions

View file

@ -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