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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
2d29ca85
Commit
2d29ca85
authored
8 years ago
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix notes on confidential issues through JSON to users without access
parent
c6ed8edf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
app/finders/notes_finder.rb
app/finders/notes_finder.rb
+1
-1
spec/finders/notes_finder_spec.rb
spec/finders/notes_finder_spec.rb
+16
-0
No files found.
app/finders/notes_finder.rb
View file @
2d29ca85
...
...
@@ -12,7 +12,7 @@ class NotesFinder
when
"commit"
project
.
notes
.
for_commit_id
(
target_id
).
non_diff_notes
when
"issue"
project
.
issues
.
find
(
target_id
).
notes
.
inc_author
project
.
issues
.
visible_to_user
(
current_user
).
find
(
target_id
).
notes
.
inc_author
when
"merge_request"
project
.
merge_requests
.
find
(
target_id
).
mr_and_commit_notes
.
inc_author
when
"snippet"
,
"project_snippet"
...
...
This diff is collapsed.
Click to expand it.
spec/finders/notes_finder_spec.rb
View file @
2d29ca85
...
...
@@ -34,5 +34,21 @@ describe NotesFinder do
notes
=
NotesFinder
.
new
.
execute
(
project
,
user
,
params
)
expect
(
notes
).
to
eq
([
note1
])
end
context
'confidential issue notes'
do
let
(
:confidential_issue
)
{
create
(
:issue
,
:confidential
,
project:
project
,
author:
user
)
}
let!
(
:confidential_note
)
{
create
(
:note
,
noteable:
confidential_issue
,
project:
confidential_issue
.
project
)
}
let
(
:params
)
{
{
target_id:
confidential_issue
.
id
,
target_type:
'issue'
,
last_fetched_at:
1
.
hour
.
ago
.
to_i
}
}
it
'returns notes if user can see the issue'
do
expect
(
NotesFinder
.
new
.
execute
(
project
,
user
,
params
)).
to
eq
([
confidential_note
])
end
it
'raises an error if user can not see the issue'
do
user
=
create
(
:user
)
expect
{
NotesFinder
.
new
.
execute
(
project
,
user
,
params
)
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
end
end
end
end
This diff is collapsed.
Click to expand it.
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