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
cea7ba51
Commit
cea7ba51
authored
Jul 16, 2019
by
Sarah Yasonik
Committed by
Douglas Barbosa Alexandre
Jul 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename Redactor classes to ReferenceRedactor
parent
b8d876f1
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
13 additions
and
13 deletions
+13
-13
config/initializers/zz_metrics.rb
config/initializers/zz_metrics.rb
+1
-1
lib/banzai/filter/reference_redactor_filter.rb
lib/banzai/filter/reference_redactor_filter.rb
+2
-2
lib/banzai/object_renderer.rb
lib/banzai/object_renderer.rb
+1
-1
lib/banzai/pipeline/post_process_pipeline.rb
lib/banzai/pipeline/post_process_pipeline.rb
+1
-1
lib/banzai/reference_redactor.rb
lib/banzai/reference_redactor.rb
+1
-1
lib/banzai/renderer.rb
lib/banzai/renderer.rb
+1
-1
spec/lib/banzai/filter/reference_redactor_filter_spec.rb
spec/lib/banzai/filter/reference_redactor_filter_spec.rb
+1
-1
spec/lib/banzai/object_renderer_spec.rb
spec/lib/banzai/object_renderer_spec.rb
+4
-4
spec/lib/banzai/reference_redactor_spec.rb
spec/lib/banzai/reference_redactor_spec.rb
+1
-1
No files found.
config/initializers/zz_metrics.rb
View file @
cea7ba51
...
...
@@ -53,7 +53,7 @@ def instrument_classes(instrumentation)
instrumentation
.
instrument_methods
(
Banzai
::
Querying
)
instrumentation
.
instrument_instance_methods
(
Banzai
::
ObjectRenderer
)
instrumentation
.
instrument_instance_methods
(
Banzai
::
Redactor
)
instrumentation
.
instrument_instance_methods
(
Banzai
::
Re
ferenceRe
dactor
)
[
Issuable
,
Mentionable
,
Participable
].
each
do
|
klass
|
instrumentation
.
instrument_instance_methods
(
klass
)
...
...
lib/banzai/filter/redactor_filter.rb
→
lib/banzai/filter/re
ference_re
dactor_filter.rb
View file @
cea7ba51
...
...
@@ -7,12 +7,12 @@ module Banzai
#
# Expected to be run in its own post-processing pipeline.
#
class
RedactorFilter
<
HTML
::
Pipeline
::
Filter
class
Re
ferenceRe
dactorFilter
<
HTML
::
Pipeline
::
Filter
def
call
unless
context
[
:skip_redaction
]
context
=
RenderContext
.
new
(
project
,
current_user
)
Redactor
.
new
(
context
).
redact
([
doc
])
Re
ferenceRe
dactor
.
new
(
context
).
redact
([
doc
])
end
doc
...
...
lib/banzai/object_renderer.rb
View file @
cea7ba51
...
...
@@ -72,7 +72,7 @@ module Banzai
#
# Returns an Array containing the redacted documents.
def
redact_documents
(
documents
)
redactor
=
Redactor
.
new
(
context
)
redactor
=
Re
ferenceRe
dactor
.
new
(
context
)
redactor
.
redact
(
documents
)
end
...
...
lib/banzai/pipeline/post_process_pipeline.rb
View file @
cea7ba51
...
...
@@ -12,7 +12,7 @@ module Banzai
def
self
.
internal_link_filters
[
Filter
::
RedactorFilter
,
Filter
::
Re
ferenceRe
dactorFilter
,
Filter
::
InlineMetricsRedactorFilter
,
Filter
::
RelativeLinkFilter
,
Filter
::
IssuableStateFilter
,
...
...
lib/banzai/redactor.rb
→
lib/banzai/re
ference_re
dactor.rb
View file @
cea7ba51
...
...
@@ -3,7 +3,7 @@
module
Banzai
# Class for removing Markdown references a certain user is not allowed to
# view.
class
Redactor
class
Re
ferenceRe
dactor
attr_reader
:context
# context - An instance of `Banzai::RenderContext`.
...
...
lib/banzai/renderer.rb
View file @
cea7ba51
...
...
@@ -134,7 +134,7 @@ module Banzai
#
# This method is used to perform state-dependent changes to a String of
# HTML, such as removing references that the current user doesn't have
# permission to make (`RedactorFilter`).
# permission to make (`Re
ferenceRe
dactorFilter`).
#
# html - String to process
# context - Hash of options to customize output
...
...
spec/lib/banzai/filter/redactor_filter_spec.rb
→
spec/lib/banzai/filter/re
ference_re
dactor_filter_spec.rb
View file @
cea7ba51
require
'spec_helper'
describe
Banzai
::
Filter
::
RedactorFilter
do
describe
Banzai
::
Filter
::
Re
ferenceRe
dactorFilter
do
include
ActionView
::
Helpers
::
UrlHelper
include
FilterSpecHelper
...
...
spec/lib/banzai/object_renderer_spec.rb
View file @
cea7ba51
...
...
@@ -22,8 +22,8 @@ describe Banzai::ObjectRenderer do
expect
(
object
.
user_visible_reference_count
).
to
eq
0
end
it
'calls Banzai::Redactor to perform redaction'
do
expect_any_instance_of
(
Banzai
::
Redactor
).
to
receive
(
:redact
).
and_call_original
it
'calls Banzai::Re
ferenceRe
dactor to perform redaction'
do
expect_any_instance_of
(
Banzai
::
Re
ferenceRe
dactor
).
to
receive
(
:redact
).
and_call_original
renderer
.
render
([
object
],
:note
)
end
...
...
@@ -82,8 +82,8 @@ describe Banzai::ObjectRenderer do
expect
(
cacheless_thing
.
redacted_title_html
).
to
eq
(
"Merge branch 'branch-merged' into 'master'"
)
end
it
'calls Banzai::Redactor to perform redaction'
do
expect_any_instance_of
(
Banzai
::
Redactor
).
to
receive
(
:redact
).
and_call_original
it
'calls Banzai::Re
ferenceRe
dactor to perform redaction'
do
expect_any_instance_of
(
Banzai
::
Re
ferenceRe
dactor
).
to
receive
(
:redact
).
and_call_original
renderer
.
render
([
cacheless_thing
],
:title
)
end
...
...
spec/lib/banzai/redactor_spec.rb
→
spec/lib/banzai/re
ference_re
dactor_spec.rb
View file @
cea7ba51
require
'spec_helper'
describe
Banzai
::
Redactor
do
describe
Banzai
::
Re
ferenceRe
dactor
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
build
(
:project
)
}
let
(
:redactor
)
{
described_class
.
new
(
Banzai
::
RenderContext
.
new
(
project
,
user
))
}
...
...
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