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
3949e4b1
Commit
3949e4b1
authored
Jul 16, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
e9da4f15
b545cf40
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 @
3949e4b1
...
@@ -54,7 +54,7 @@ def instrument_classes(instrumentation)
...
@@ -54,7 +54,7 @@ def instrument_classes(instrumentation)
instrumentation
.
instrument_methods
(
Banzai
::
Querying
)
instrumentation
.
instrument_methods
(
Banzai
::
Querying
)
instrumentation
.
instrument_instance_methods
(
Banzai
::
ObjectRenderer
)
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
|
[
Issuable
,
Mentionable
,
Participable
].
each
do
|
klass
|
instrumentation
.
instrument_instance_methods
(
klass
)
instrumentation
.
instrument_instance_methods
(
klass
)
...
...
lib/banzai/filter/redactor_filter.rb
→
lib/banzai/filter/re
ference_re
dactor_filter.rb
View file @
3949e4b1
...
@@ -7,12 +7,12 @@ module Banzai
...
@@ -7,12 +7,12 @@ module Banzai
#
#
# Expected to be run in its own post-processing pipeline.
# Expected to be run in its own post-processing pipeline.
#
#
class
RedactorFilter
<
HTML
::
Pipeline
::
Filter
class
Re
ferenceRe
dactorFilter
<
HTML
::
Pipeline
::
Filter
def
call
def
call
unless
context
[
:skip_redaction
]
unless
context
[
:skip_redaction
]
context
=
RenderContext
.
new
(
project
,
current_user
)
context
=
RenderContext
.
new
(
project
,
current_user
)
Redactor
.
new
(
context
).
redact
([
doc
])
Re
ferenceRe
dactor
.
new
(
context
).
redact
([
doc
])
end
end
doc
doc
...
...
lib/banzai/object_renderer.rb
View file @
3949e4b1
...
@@ -72,7 +72,7 @@ module Banzai
...
@@ -72,7 +72,7 @@ module Banzai
#
#
# Returns an Array containing the redacted documents.
# Returns an Array containing the redacted documents.
def
redact_documents
(
documents
)
def
redact_documents
(
documents
)
redactor
=
Redactor
.
new
(
context
)
redactor
=
Re
ferenceRe
dactor
.
new
(
context
)
redactor
.
redact
(
documents
)
redactor
.
redact
(
documents
)
end
end
...
...
lib/banzai/pipeline/post_process_pipeline.rb
View file @
3949e4b1
...
@@ -14,7 +14,7 @@ module Banzai
...
@@ -14,7 +14,7 @@ module Banzai
def
self
.
internal_link_filters
def
self
.
internal_link_filters
[
[
Filter
::
RedactorFilter
,
Filter
::
Re
ferenceRe
dactorFilter
,
Filter
::
InlineMetricsRedactorFilter
,
Filter
::
InlineMetricsRedactorFilter
,
Filter
::
RelativeLinkFilter
,
Filter
::
RelativeLinkFilter
,
Filter
::
IssuableStateFilter
,
Filter
::
IssuableStateFilter
,
...
...
lib/banzai/redactor.rb
→
lib/banzai/re
ference_re
dactor.rb
View file @
3949e4b1
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
module
Banzai
module
Banzai
# Class for removing Markdown references a certain user is not allowed to
# Class for removing Markdown references a certain user is not allowed to
# view.
# view.
class
Redactor
class
Re
ferenceRe
dactor
attr_reader
:context
attr_reader
:context
# context - An instance of `Banzai::RenderContext`.
# context - An instance of `Banzai::RenderContext`.
...
...
lib/banzai/renderer.rb
View file @
3949e4b1
...
@@ -134,7 +134,7 @@ module Banzai
...
@@ -134,7 +134,7 @@ module Banzai
#
#
# This method is used to perform state-dependent changes to a String of
# 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
# 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
# html - String to process
# context - Hash of options to customize output
# 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 @
3949e4b1
require
'spec_helper'
require
'spec_helper'
describe
Banzai
::
Filter
::
RedactorFilter
do
describe
Banzai
::
Filter
::
Re
ferenceRe
dactorFilter
do
include
ActionView
::
Helpers
::
UrlHelper
include
ActionView
::
Helpers
::
UrlHelper
include
FilterSpecHelper
include
FilterSpecHelper
...
...
spec/lib/banzai/object_renderer_spec.rb
View file @
3949e4b1
...
@@ -22,8 +22,8 @@ describe Banzai::ObjectRenderer do
...
@@ -22,8 +22,8 @@ describe Banzai::ObjectRenderer do
expect
(
object
.
user_visible_reference_count
).
to
eq
0
expect
(
object
.
user_visible_reference_count
).
to
eq
0
end
end
it
'calls Banzai::Redactor to perform redaction'
do
it
'calls Banzai::Re
ferenceRe
dactor to perform redaction'
do
expect_any_instance_of
(
Banzai
::
Redactor
).
to
receive
(
:redact
).
and_call_original
expect_any_instance_of
(
Banzai
::
Re
ferenceRe
dactor
).
to
receive
(
:redact
).
and_call_original
renderer
.
render
([
object
],
:note
)
renderer
.
render
([
object
],
:note
)
end
end
...
@@ -82,8 +82,8 @@ describe Banzai::ObjectRenderer do
...
@@ -82,8 +82,8 @@ describe Banzai::ObjectRenderer do
expect
(
cacheless_thing
.
redacted_title_html
).
to
eq
(
"Merge branch 'branch-merged' into 'master'"
)
expect
(
cacheless_thing
.
redacted_title_html
).
to
eq
(
"Merge branch 'branch-merged' into 'master'"
)
end
end
it
'calls Banzai::Redactor to perform redaction'
do
it
'calls Banzai::Re
ferenceRe
dactor to perform redaction'
do
expect_any_instance_of
(
Banzai
::
Redactor
).
to
receive
(
:redact
).
and_call_original
expect_any_instance_of
(
Banzai
::
Re
ferenceRe
dactor
).
to
receive
(
:redact
).
and_call_original
renderer
.
render
([
cacheless_thing
],
:title
)
renderer
.
render
([
cacheless_thing
],
:title
)
end
end
...
...
spec/lib/banzai/redactor_spec.rb
→
spec/lib/banzai/re
ference_re
dactor_spec.rb
View file @
3949e4b1
require
'spec_helper'
require
'spec_helper'
describe
Banzai
::
Redactor
do
describe
Banzai
::
Re
ferenceRe
dactor
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
build
(
:project
)
}
let
(
:project
)
{
build
(
:project
)
}
let
(
:redactor
)
{
described_class
.
new
(
Banzai
::
RenderContext
.
new
(
project
,
user
))
}
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