FIX: Use only first line from commit message (#18724)
Linking a commit from a GitHub pull request included the complete commit message, instead of just the first line. The rest of the commit message will be added to the body of the Onebox.
This commit is contained in:
parent
f4c70283f7
commit
266e165885
|
@ -40,7 +40,7 @@ module Onebox
|
|||
result['body'], result['excerpt'] = compute_body(result['body'])
|
||||
|
||||
if result['commit'] = load_commit(link)
|
||||
result['body'], result['excerpt'] = compute_body(result['commit']['body'])
|
||||
result['body'], result['excerpt'] = compute_body(result['commit']['commit']['message'].lines[1..].join)
|
||||
elsif result['comment'] = load_comment(link)
|
||||
result['body'], result['excerpt'] = compute_body(result['comment']['body'])
|
||||
elsif result['discussion'] = load_review(link)
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<div class="github-info-container">
|
||||
{{#commit}}
|
||||
<h4>
|
||||
<a href="{{link}}" target="_blank" rel="noopener">{{commit.message}}</a>
|
||||
<a href="{{link}}" target="_blank" rel="noopener">{{commit.message.lines.first}}</a>
|
||||
</h4>
|
||||
|
||||
<span>
|
||||
|
|
|
@ -59,7 +59,9 @@ RSpec.describe Onebox::Engine::GithubPullRequestOnebox do
|
|||
end
|
||||
|
||||
it "includes commit name" do
|
||||
expect(html).to include("Add audio onebox")
|
||||
doc = Nokogiri::HTML5(html)
|
||||
expect(doc.css('h4').text.strip).to eq("Add audio onebox")
|
||||
expect(doc.css('.github-body-container').text).to include("http://meta.discourse.org/t/audio-html5-tag/8168")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue