diff options
author | mrsdizzie <info@mrsdizzie.com> | 2020-05-22 09:14:02 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-22 14:14:02 +0100 |
commit | 5789e603161aff311f8afcc15585892e783c931e (patch) | |
tree | deaca47b857702ee15d5e1dcdebfa7534b6f2425 /routers/repo/wiki.go | |
parent | 6af13dbac2179c8fd2c63bcf175c04a112f8c080 (diff) | |
download | gitea-5789e603161aff311f8afcc15585892e783c931e.tar.gz gitea-5789e603161aff311f8afcc15585892e783c931e.zip |
Use default commit message for wiki edits (#11550)
Use a default commit message when a user doesn't add one (same as repo editor) to avoid commit lists with no message
Diffstat (limited to 'routers/repo/wiki.go')
-rw-r--r-- | routers/repo/wiki.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/routers/repo/wiki.go b/routers/repo/wiki.go index 5da01f21ac..cc60b4388d 100644 --- a/routers/repo/wiki.go +++ b/routers/repo/wiki.go @@ -572,6 +572,11 @@ func NewWikiPost(ctx *context.Context, form auth.NewWikiForm) { } wikiName := wiki_service.NormalizeWikiName(form.Title) + + if len(form.Message) == 0 { + form.Message = ctx.Tr("repo.editor.add", form.Title) + } + if err := wiki_service.AddWikiPage(ctx.User, ctx.Repo.Repository, wikiName, form.Content, form.Message); err != nil { if models.IsErrWikiReservedName(err) { ctx.Data["Err_Title"] = true @@ -621,6 +626,10 @@ func EditWikiPost(ctx *context.Context, form auth.NewWikiForm) { oldWikiName := wiki_service.NormalizeWikiName(ctx.Params(":page")) newWikiName := wiki_service.NormalizeWikiName(form.Title) + if len(form.Message) == 0 { + form.Message = ctx.Tr("repo.editor.update", form.Title) + } + if err := wiki_service.EditWikiPage(ctx.User, ctx.Repo.Repository, oldWikiName, newWikiName, form.Content, form.Message); err != nil { ctx.ServerError("EditWikiPage", err) return |