lib/onebox/engine/github_commit_onebox.rb in onebox-1.8.38 vs lib/onebox/engine/github_commit_onebox.rb in onebox-1.8.39

- old
+ new

@@ -28,10 +28,16 @@ result = raw.clone result['link'] = link result['title'] = result['commit']['message'].split("\n").first if result['commit']['message'].lines.count > 1 - result['message'] = result['commit']['message'].split("\n", 2).last.strip + message = result['commit']['message'].split("\n", 2).last.strip + + message_words = message.gsub("\n\n", "\n").gsub("\n", "<br>").split(" ") + max_words = 20 + result['message'] = message_words[0..max_words].join(" ") + result['message'] << "..." if message_words.length > max_words + result['message'] = result['message'].gsub("<br>", "\n") end ulink = URI(link) result['commit_date'] = Time.parse(result['commit']['author']['date']).strftime("%I:%M%p - %d %b %y") result['domain'] = "#{ulink.host}/#{ulink.path.split('/')[1]}/#{ulink.path.split('/')[2]}"