mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
* Fixes #7152 - Allow create/update/delete message to be empty, use default message * Linting fix * Fix to delete integration tests
This commit is contained in:
parent
462284e2f5
commit
002b597c1f
7 changed files with 104 additions and 27 deletions
|
@ -204,6 +204,11 @@ func CreateFile(ctx *context.APIContext, apiOpts api.CreateFileOptions) {
|
|||
Email: apiOpts.Author.Email,
|
||||
},
|
||||
}
|
||||
|
||||
if opts.Message == "" {
|
||||
opts.Message = ctx.Tr("repo.editor.add", opts.TreePath)
|
||||
}
|
||||
|
||||
if fileResponse, err := createOrUpdateFile(ctx, opts); err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "CreateFile", err)
|
||||
} else {
|
||||
|
@ -264,6 +269,10 @@ func UpdateFile(ctx *context.APIContext, apiOpts api.UpdateFileOptions) {
|
|||
},
|
||||
}
|
||||
|
||||
if opts.Message == "" {
|
||||
opts.Message = ctx.Tr("repo.editor.update", opts.TreePath)
|
||||
}
|
||||
|
||||
if fileResponse, err := createOrUpdateFile(ctx, opts); err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "UpdateFile", err)
|
||||
} else {
|
||||
|
@ -346,6 +355,10 @@ func DeleteFile(ctx *context.APIContext, apiOpts api.DeleteFileOptions) {
|
|||
},
|
||||
}
|
||||
|
||||
if opts.Message == "" {
|
||||
opts.Message = ctx.Tr("repo.editor.delete", opts.TreePath)
|
||||
}
|
||||
|
||||
if fileResponse, err := repofiles.DeleteRepoFile(ctx.Repo.Repository, ctx.User, opts); err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "DeleteFile", err)
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue