diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-25 06:08:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-25 06:08:49 +0300 |
commit | a8c82a6395ed62380b9061a26d92e41d46c2877e (patch) | |
tree | bd8ab49ac11104ad9ae953afd4c5e0036fdddaa2 /lib/banzai/filter/inline_embeds_filter.rb | |
parent | 0b881f91159cc97ccb7328a2e52977a60ea83fbe (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/banzai/filter/inline_embeds_filter.rb')
-rw-r--r-- | lib/banzai/filter/inline_embeds_filter.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/banzai/filter/inline_embeds_filter.rb b/lib/banzai/filter/inline_embeds_filter.rb index 9f1ef0796f0..5b579aeae6b 100644 --- a/lib/banzai/filter/inline_embeds_filter.rb +++ b/lib/banzai/filter/inline_embeds_filter.rb @@ -6,6 +6,7 @@ module Banzai # a given link format. To transform references to DB # resources in place, prefer to inherit from AbstractReferenceFilter. class InlineEmbedsFilter < HTML::Pipeline::Filter + include Gitlab::Utils::StrongMemoize # Find every relevant link, create a new node based on # the link, and insert this node after any html content # surrounding the link. @@ -60,6 +61,16 @@ module Banzai link_pattern.match(url) { |m| m.named_captures } end + + # Parses query params out from full url string into hash. + # + # Ex) 'https://<root>/<project>/<environment>/metrics?title=Title&group=Group' + # --> { title: 'Title', group: 'Group' } + def query_params(url) + strong_memoize(:query_params) do + Gitlab::Metrics::Dashboard::Url.parse_query(url) + end + end end end end |