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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
7982f091
Commit
7982f091
authored
Feb 15, 2022
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inherit TimelineEventPipeline from PlainMarkdownPipeline
parent
bdcd884f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
26 deletions
+8
-26
ee/lib/banzai/pipeline/timeline_event_pipeline.rb
ee/lib/banzai/pipeline/timeline_event_pipeline.rb
+5
-15
ee/spec/lib/banzai/pipeline/timeline_event_pipeline_spec.rb
ee/spec/lib/banzai/pipeline/timeline_event_pipeline_spec.rb
+3
-11
No files found.
ee/lib/banzai/pipeline/timeline_event_pipeline.rb
View file @
7982f091
...
@@ -2,34 +2,24 @@
...
@@ -2,34 +2,24 @@
module
Banzai
module
Banzai
module
Pipeline
module
Pipeline
class
TimelineEventPipeline
<
Base
Pipeline
class
TimelineEventPipeline
<
PlainMarkdown
Pipeline
ALLOWLIST
=
Banzai
::
Filter
::
SanitizationFilter
::
LIMITED
.
deep_dup
.
merge
(
ALLOWLIST
=
Banzai
::
Filter
::
SanitizationFilter
::
LIMITED
.
deep_dup
.
merge
(
elements:
%w(p b i strong em pre code a img)
elements:
%w(p b i strong em pre code a img)
)
)
def
self
.
filters
def
self
.
filters
@filters
||=
FilterArray
[
@filters
||=
FilterArray
[
Filter
::
MarkdownFilter
,
*
super
,
*
reference_filters
,
Filter
::
EmojiFilter
,
Filter
::
EmojiFilter
,
Filter
::
ExternalLinkFilter
,
Filter
::
ExternalLinkFilter
,
Filter
::
ImageLinkFilter
,
Filter
::
ImageLinkFilter
,
Filter
::
SanitizationFilter
,
Filter
::
SanitizationFilter
*
reference_filters
]
]
end
end
def
self
.
reference_filters
def
self
.
reference_filters
[
Banzai
::
Pipeline
::
GfmPipeline
.
reference_filters
Filter
::
References
::
UserReferenceFilter
,
Filter
::
References
::
IssueReferenceFilter
,
Filter
::
References
::
ExternalIssueReferenceFilter
,
Filter
::
References
::
MergeRequestReferenceFilter
,
Filter
::
References
::
SnippetReferenceFilter
,
Filter
::
References
::
CommitRangeReferenceFilter
,
Filter
::
References
::
CommitReferenceFilter
,
Filter
::
References
::
AlertReferenceFilter
,
Filter
::
References
::
FeatureFlagReferenceFilter
]
end
end
def
self
.
transform_context
(
context
)
def
self
.
transform_context
(
context
)
...
...
ee/spec/lib/banzai/pipeline/timeline_event_pipeline_spec.rb
View file @
7982f091
...
@@ -8,15 +8,7 @@ RSpec.describe Banzai::Pipeline::TimelineEventPipeline do
...
@@ -8,15 +8,7 @@ RSpec.describe Banzai::Pipeline::TimelineEventPipeline do
describe
'.reference_filters'
do
describe
'.reference_filters'
do
it
'contains required reference filters'
do
it
'contains required reference filters'
do
expect
(
described_class
.
reference_filters
).
to
contain_exactly
(
expect
(
described_class
.
reference_filters
).
to
contain_exactly
(
Banzai
::
Filter
::
References
::
UserReferenceFilter
,
*
Banzai
::
Pipeline
::
GfmPipeline
.
reference_filters
Banzai
::
Filter
::
References
::
IssueReferenceFilter
,
Banzai
::
Filter
::
References
::
ExternalIssueReferenceFilter
,
Banzai
::
Filter
::
References
::
MergeRequestReferenceFilter
,
Banzai
::
Filter
::
References
::
SnippetReferenceFilter
,
Banzai
::
Filter
::
References
::
CommitRangeReferenceFilter
,
Banzai
::
Filter
::
References
::
CommitReferenceFilter
,
Banzai
::
Filter
::
References
::
AlertReferenceFilter
,
Banzai
::
Filter
::
References
::
FeatureFlagReferenceFilter
)
)
end
end
end
end
...
@@ -30,10 +22,10 @@ RSpec.describe Banzai::Pipeline::TimelineEventPipeline do
...
@@ -30,10 +22,10 @@ RSpec.describe Banzai::Pipeline::TimelineEventPipeline do
it
{
is_expected
.
to
eq
(
'<p><strong>bold</strong> <em>italic</em> <code>code</code></p>'
)
}
it
{
is_expected
.
to
eq
(
'<p><strong>bold</strong> <em>italic</em> <code>code</code></p>'
)
}
end
end
context
'when markdown contains
not allow
ed HTML tags'
do
context
'when markdown contains
bann
ed HTML tags'
do
let
(
:markdown
)
{
'<div>div</div><h1>h1</h1>'
}
let
(
:markdown
)
{
'<div>div</div><h1>h1</h1>'
}
it
'filters out
not allow
ed tags'
do
it
'filters out
bann
ed tags'
do
is_expected
.
to
eq
(
' div h1 '
)
is_expected
.
to
eq
(
' div h1 '
)
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