mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-22 08:42:32 -05:00
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
This commit is contained in:
parent
6af13dbac2
commit
5789e60316
1 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue