lib/onebox/engine/github_pullrequest_onebox.rb in onebox-2.2.11 vs lib/onebox/engine/github_pullrequest_onebox.rb in onebox-2.2.12
- old
+ new
@@ -18,10 +18,11 @@
def match
@match ||= @url.match(%r{github\.com/(?<owner>[^/]+)/(?<repository>[^/]+)/pull/(?<number>[^/]+)})
end
+ GITHUB_COMMENT_REGEX = /(<!--.*?-->\r\n)/
def data
result = raw.clone
result['link'] = link
created_at = Time.parse(result['created_at'])
@@ -29,9 +30,13 @@
result['created_at_date'] = created_at.strftime("%F")
result['created_at_time'] = created_at.strftime("%T")
ulink = URI(link)
result['domain'] = "#{ulink.host}/#{ulink.path.split('/')[1]}/#{ulink.path.split('/')[2]}"
+
+ body = (result['body'] || '').gsub(GITHUB_COMMENT_REGEX, '')
+ result['body'] = body.present? ? body : nil
+
result
end
end
end
end