Skip to content

A platform for community discussion. Free, open, simple.

UX: Strip multiline comments in github oneboxes (#30040)

David Taylorb47ae6d43718
diff --git a/lib/onebox/engine/github_pull_request_onebox.rb b/lib/onebox/engine/github_pull_request_onebox.rb
index 3ddb048d52e..5ade5ed018c 100644
--- a/lib/onebox/engine/github_pull_request_onebox.rb
+++ b/lib/onebox/engine/github_pull_request_onebox.rb
@@ -12,8 +12,6 @@ module Onebox
include Onebox::Mixins::GithubBody
include Onebox::Mixins::GithubAuthHeader
- GITHUB_COMMENT_REGEX = /(<!--.*?-->\r\n)/
-
matches_regexp(%r{^https?://(?:www\.)?(?:(?:\w)+\.)?(github)\.com(?:/)?(?:.)*/pull})
always_https
diff --git a/lib/onebox/engine/github_repo_onebox.rb b/lib/onebox/engine/github_repo_onebox.rb
index bd785606378..b80d82b3c84 100644
--- a/lib/onebox/engine/github_repo_onebox.rb
+++ b/lib/onebox/engine/github_repo_onebox.rb
@@ -11,7 +11,7 @@ module Onebox
include JSON
include Onebox::Mixins::GithubAuthHeader
- GITHUB_COMMENT_REGEX = /(<!--.*?-->\r\n)/
+ GITHUB_COMMENT_REGEX = /(<!--.*?-->\r\n)/m
matches_regexp(%r{^https?:\/\/(?:www\.)?(?!gist\.)[^\/]*github\.com\/[^\/]+\/[^\/]+\/?$})
always_https
diff --git a/lib/onebox/mixins/github_body.rb b/lib/onebox/mixins/github_body.rb
index b14de31a6be..7f275099abe 100644
--- a/lib/onebox/mixins/github_body.rb
+++ b/lib/onebox/mixins/github_body.rb
@@ -9,7 +9,7 @@ module Onebox
end
module InstanceMethods
- GITHUB_COMMENT_REGEX = /<!--.*?-->/
+ GITHUB_COMMENT_REGEX = /<!--.*?-->/m
MAX_BODY_LENGTH = 80
def compute_body(body)