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 @@
module
Banzai
module
Pipeline
class
TimelineEventPipeline
<
Base
Pipeline
class
TimelineEventPipeline
<
PlainMarkdown
Pipeline
ALLOWLIST
=
Banzai
::
Filter
::
SanitizationFilter
::
LIMITED
.
deep_dup
.
merge
(
elements:
%w(p b i strong em pre code a img)
)
def
self
.
filters
@filters
||=
FilterArray
[
Filter
::
MarkdownFilter
,
*
super
,
*
reference_filters
,
Filter
::
EmojiFilter
,
Filter
::
ExternalLinkFilter
,
Filter
::
ImageLinkFilter
,
Filter
::
SanitizationFilter
,
*
reference_filters
Filter
::
SanitizationFilter
]
end
def
self
.
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
]
Banzai
::
Pipeline
::
GfmPipeline
.
reference_filters
end
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
describe
'.reference_filters'
do
it
'contains required reference filters'
do
expect
(
described_class
.
reference_filters
).
to
contain_exactly
(
Banzai
::
Filter
::
References
::
UserReferenceFilter
,
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
*
Banzai
::
Pipeline
::
GfmPipeline
.
reference_filters
)
end
end
...
...
@@ -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>'
)
}
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>'
}
it
'filters out
not allow
ed tags'
do
it
'filters out
bann
ed tags'
do
is_expected
.
to
eq
(
' div h1 '
)
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