Commit a52d7dfa authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'sh-fix-issue-59065' into 'master'

Fix Error 500 when user commits Wiki page with no commit message

Closes #59065

See merge request gitlab-org/gitlab-ce!26247
parents f696bacb da18211f
...@@ -183,7 +183,7 @@ class ProjectWiki ...@@ -183,7 +183,7 @@ class ProjectWiki
end end
def commit_details(action, message = nil, title = nil) def commit_details(action, message = nil, title = nil)
commit_message = message || default_message(action, title) commit_message = message.presence || default_message(action, title)
git_user = Gitlab::Git::User.from_gitlab(@user) git_user = Gitlab::Git::User.from_gitlab(@user)
Gitlab::Git::Wiki::CommitDetails.new(@user.id, Gitlab::Git::Wiki::CommitDetails.new(@user.id,
......
---
title: Fix Error 500 when user commits Wiki page with no commit message
merge_request: 26247
author:
type: fixed
...@@ -71,6 +71,14 @@ describe ProjectWiki do ...@@ -71,6 +71,14 @@ describe ProjectWiki do
expect(project_wiki.create_page("index", "test content")).to be_truthy expect(project_wiki.create_page("index", "test content")).to be_truthy
end end
it "creates a new wiki repo with a default commit message" do
expect(project_wiki.create_page("index", "test content", :markdown, "")).to be_truthy
page = project_wiki.find_page('index')
expect(page.last_version.message).to eq("#{user.username} created page: index")
end
it "raises CouldNotCreateWikiError if it can't create the wiki repository" do it "raises CouldNotCreateWikiError if it can't create the wiki repository" do
# Create a fresh project which will not have a wiki # Create a fresh project which will not have a wiki
project_wiki = described_class.new(create(:project), user) project_wiki = described_class.new(create(:project), user)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment