Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
81da9337
Commit
81da9337
authored
Apr 10, 2019
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove multi-line suggestions feature flag
That's a straightforward feature flag code removal for 11.10
parent
6c8a13da
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
35 deletions
+4
-35
lib/banzai/filter/suggestion_filter.rb
lib/banzai/filter/suggestion_filter.rb
+0
-12
spec/lib/banzai/filter/suggestion_filter_spec.rb
spec/lib/banzai/filter/suggestion_filter_spec.rb
+4
-23
No files found.
lib/banzai/filter/suggestion_filter.rb
View file @
81da9337
...
...
@@ -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
spec/lib/banzai/filter/suggestion_filter_spec.rb
View file @
81da9337
...
...
@@ -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
'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
it
'element has correct data-lang-params'
do
doc
=
filter
(
input
,
default_context
)
pre
=
doc
.
css
(
'pre'
).
first
expect
(
pre
[
data_attr
]).
to
eq
(
'-3+2'
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment