mirror of
https://github.com/discourse/discourse.git
synced 2025-05-26 10:42:10 +08:00
UX: Strip multiline comments in github oneboxes (#30040)
We were already stripping comments from GitHub issue/PR oneboxes, but the regex was not correctly matching multiline comments.
This commit is contained in:
@ -12,8 +12,6 @@ module Onebox
|
|||||||
include Onebox::Mixins::GithubBody
|
include Onebox::Mixins::GithubBody
|
||||||
include Onebox::Mixins::GithubAuthHeader
|
include Onebox::Mixins::GithubAuthHeader
|
||||||
|
|
||||||
GITHUB_COMMENT_REGEX = /(<!--.*?-->\r\n)/
|
|
||||||
|
|
||||||
matches_regexp(%r{^https?://(?:www\.)?(?:(?:\w)+\.)?(github)\.com(?:/)?(?:.)*/pull})
|
matches_regexp(%r{^https?://(?:www\.)?(?:(?:\w)+\.)?(github)\.com(?:/)?(?:.)*/pull})
|
||||||
always_https
|
always_https
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ module Onebox
|
|||||||
include JSON
|
include JSON
|
||||||
include Onebox::Mixins::GithubAuthHeader
|
include Onebox::Mixins::GithubAuthHeader
|
||||||
|
|
||||||
GITHUB_COMMENT_REGEX = /(<!--.*?-->\r\n)/
|
GITHUB_COMMENT_REGEX = /(<!--.*?-->\r\n)/m
|
||||||
|
|
||||||
matches_regexp(%r{^https?:\/\/(?:www\.)?(?!gist\.)[^\/]*github\.com\/[^\/]+\/[^\/]+\/?$})
|
matches_regexp(%r{^https?:\/\/(?:www\.)?(?!gist\.)[^\/]*github\.com\/[^\/]+\/[^\/]+\/?$})
|
||||||
always_https
|
always_https
|
||||||
|
@ -9,7 +9,7 @@ module Onebox
|
|||||||
end
|
end
|
||||||
|
|
||||||
module InstanceMethods
|
module InstanceMethods
|
||||||
GITHUB_COMMENT_REGEX = /<!--.*?-->/
|
GITHUB_COMMENT_REGEX = /<!--.*?-->/m
|
||||||
MAX_BODY_LENGTH = 80
|
MAX_BODY_LENGTH = 80
|
||||||
|
|
||||||
def compute_body(body)
|
def compute_body(body)
|
||||||
|
Reference in New Issue
Block a user