summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOswaldo Ferreira <oswaldo@gitlab.com>2019-04-10 10:49:25 -0300
committerOswaldo Ferreira <oswaldo@gitlab.com>2019-04-10 10:52:37 -0300
commit81da9337e17d288366d4257e1bbe4ba62cb1b21c (patch)
treee9ec9624a6a27454c219404b87ead31365cba68f
parent6c8a13da33e5ff11210122f7863d36f989b99630 (diff)
downloadgitlab-ce-81da9337e17d288366d4257e1bbe4ba62cb1b21c.tar.gz
Remove multi-line suggestions feature flagosw-remote-multi-line-suggestions-ff
That's a straightforward feature flag code removal for 11.10
-rw-r--r--lib/banzai/filter/suggestion_filter.rb12
-rw-r--r--spec/lib/banzai/filter/suggestion_filter_spec.rb27
2 files changed, 4 insertions, 35 deletions
diff --git a/lib/banzai/filter/suggestion_filter.rb b/lib/banzai/filter/suggestion_filter.rb
index 848aca10a20..3d40abfc540 100644
--- a/lib/banzai/filter/suggestion_filter.rb
+++ b/lib/banzai/filter/suggestion_filter.rb
@@ -6,15 +6,11 @@ module Banzai
class SuggestionFilter < HTML::Pipeline::Filter
# Class used for tagging elements that should be rendered
TAG_CLASS = 'js-render-suggestion'.freeze
- SUGGESTION_REGEX = Gitlab::Diff::SuggestionsParser::SUGGESTION_CONTEXT
def call
return doc unless suggestions_filter_enabled?
doc.search('pre.suggestion > code').each do |node|
- # TODO: Remove once multi-line suggestions FF get removed (#59178).
- remove_multi_line_params(node.parent)
-
node.add_class(TAG_CLASS)
end
@@ -30,14 +26,6 @@ module Banzai
def project
context[:project]
end
-
- def remove_multi_line_params(node)
- return if Feature.enabled?(:multi_line_suggestions, project)
-
- if node[SyntaxHighlightFilter::LANG_PARAMS_ATTR]&.match?(SUGGESTION_REGEX)
- node.remove_attribute(SyntaxHighlightFilter::LANG_PARAMS_ATTR)
- end
- end
end
end
end
diff --git a/spec/lib/banzai/filter/suggestion_filter_spec.rb b/spec/lib/banzai/filter/suggestion_filter_spec.rb
index af6f002fa30..9c4650b73de 100644
--- a/spec/lib/banzai/filter/suggestion_filter_spec.rb
+++ b/spec/lib/banzai/filter/suggestion_filter_spec.rb
@@ -28,30 +28,11 @@ describe Banzai::Filter::SuggestionFilter do
let(:data_attr) { Banzai::Filter::SyntaxHighlightFilter::LANG_PARAMS_ATTR }
let(:input) { %(<pre class="code highlight js-syntax-highlight suggestion" #{data_attr}="-3+2"><code>foo\n</code></pre>) }
- context 'feature disabled' do
- before do
- stub_feature_flags(multi_line_suggestions: false)
- end
+ it 'element has correct data-lang-params' do
+ doc = filter(input, default_context)
+ pre = doc.css('pre').first
- it 'removes data-lang-params if it matches a multi-line suggestion param' do
- doc = filter(input, default_context)
- pre = doc.css('pre').first
-
- expect(pre[data_attr]).to be_nil
- end
- end
-
- context 'feature enabled' do
- before do
- stub_feature_flags(multi_line_suggestions: true)
- end
-
- it 'keeps data-lang-params' do
- doc = filter(input, default_context)
- pre = doc.css('pre').first
-
- expect(pre[data_attr]).to eq('-3+2')
- end
+ expect(pre[data_attr]).to eq('-3+2')
end
end
end