aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
authorRichard Mahn <richmahn@users.noreply.github.com>2019-06-29 11:19:24 -0400
committerzeripath <art27@cantab.net>2019-06-29 16:19:24 +0100
commit002b597c1f87cd5c69d32053a62f57c08d48d3ee (patch)
treec14ccd9f1a1b02e21759a4fcae569d8c8116df4f /routers/api
parent462284e2f5768cf04d71c7abd8c01eef20cff73d (diff)
downloadgitea-002b597c1f87cd5c69d32053a62f57c08d48d3ee.tar.gz
gitea-002b597c1f87cd5c69d32053a62f57c08d48d3ee.zip
Fixes #7152 - Allow create/update/delete message to be empty, use default message (#7324)
* Fixes #7152 - Allow create/update/delete message to be empty, use default message * Linting fix * Fix to delete integration tests
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/repo/file.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/routers/api/v1/repo/file.go b/routers/api/v1/repo/file.go
index 20f80f37f4..d510756283 100644
--- a/routers/api/v1/repo/file.go
+++ b/routers/api/v1/repo/file.go
@@ -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 {