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
4ded8adf
Commit
4ded8adf
authored
Feb 25, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove references for confidential issues
parent
dc4c8769
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletion
+33
-1
lib/banzai/filter/issue_reference_filter.rb
lib/banzai/filter/issue_reference_filter.rb
+9
-0
spec/lib/banzai/filter/redactor_filter_spec.rb
spec/lib/banzai/filter/redactor_filter_spec.rb
+24
-1
No files found.
lib/banzai/filter/issue_reference_filter.rb
View file @
4ded8adf
...
...
@@ -9,6 +9,15 @@ module Banzai
Issue
end
def
self
.
user_can_see_reference?
(
user
,
node
,
context
)
if
node
.
has_attribute?
(
'data-issue'
)
issue
=
Issue
.
find
(
node
.
attr
(
'data-issue'
))
rescue
nil
issue
&&
!
issue
.
confidential?
else
super
end
end
def
find_object
(
project
,
id
)
project
.
get_issue
(
id
)
end
...
...
spec/lib/banzai/filter/redactor_filter_spec.rb
View file @
4ded8adf
...
...
@@ -44,8 +44,31 @@ describe Banzai::Filter::RedactorFilter, lib: true do
end
end
context
"for user references"
do
context
'with data-issue'
do
it
'removes references for confidential issues'
do
user
=
create
(
:user
)
project
=
create
(
:empty_project
)
issue
=
create
(
:issue
,
:confidential
,
project:
project
)
link
=
reference_link
(
issue:
issue
.
id
,
reference_filter:
'IssueReferenceFilter'
)
doc
=
filter
(
link
,
current_user:
user
)
expect
(
doc
.
css
(
'a'
).
length
).
to
eq
0
end
it
'allows references for non confidential issues'
do
user
=
create
(
:user
)
project
=
create
(
:empty_project
)
issue
=
create
(
:issue
,
project:
project
)
link
=
reference_link
(
issue:
issue
.
id
,
reference_filter:
'IssueReferenceFilter'
)
doc
=
filter
(
link
,
current_user:
user
)
expect
(
doc
.
css
(
'a'
).
length
).
to
eq
1
end
end
context
"for user references"
do
context
'with data-group'
do
it
'removes unpermitted Group references'
do
user
=
create
(
: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