Commit b398510f authored by Nick Thomas's avatar Nick Thomas

Merge branch 'id-fix-suggestions' into 'master'

Fix applying suggestion with empty custom message

See merge request gitlab-org/gitlab!24144
parents 397750d4 e25c5a04
......@@ -96,7 +96,7 @@ module Suggestions
end
def suggestion_commit_message(project)
project.suggestion_commit_message || DEFAULT_SUGGESTION_COMMIT_MESSAGE
project.suggestion_commit_message.presence || DEFAULT_SUGGESTION_COMMIT_MESSAGE
end
def processed_suggestion_commit_message(suggestion)
......
---
title: Fix applying the suggestions with an empty custom message
merge_request: 24144
author:
type: fixed
......@@ -57,10 +57,22 @@ describe Suggestions::ApplyService do
end
context 'is not specified' do
let(:expected_value) { "Apply suggestion to files/ruby/popen.rb" }
context 'is nil' do
let(:message) { nil }
it 'sets default commit message' do
expect(project.repository.commit.message).to eq("Apply suggestion to files/ruby/popen.rb")
expect(project.repository.commit.message).to eq(expected_value)
end
end
context 'is an empty string' do
let(:message) { '' }
it 'sets default commit message' do
expect(project.repository.commit.message).to eq(expected_value)
end
end
end
......
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