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
c69a4704
Commit
c69a4704
authored
Aug 02, 2019
by
Patrick Derichs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use NotesFinder#target to find Epics
parent
5ebbe95a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
lib/api/helpers/notes_helpers.rb
lib/api/helpers/notes_helpers.rb
+9
-3
No files found.
lib/api/helpers/notes_helpers.rb
View file @
c69a4704
...
...
@@ -74,14 +74,14 @@ module API
end
def
find_noteable
(
parent_type
,
parent_id
,
noteable_type
,
noteable_id
)
params
=
params_by_noteable_type_and_id
(
noteable_type
,
noteable
_id
)
params
=
finder_params_by_noteable_type_and_id
(
noteable_type
,
noteable_id
,
parent
_id
)
noteable
=
NotesFinder
.
new
(
current_user
,
params
.
merge
(
project:
user_project
)
).
target
noteable
=
NotesFinder
.
new
(
current_user
,
params
).
target
noteable
=
nil
unless
can?
(
current_user
,
noteable_read_ability_name
(
noteable
),
noteable
)
noteable
||
not_found!
(
noteable_type
)
end
def
params_by_noteable_type_and_id
(
type
,
id
)
def
finder_params_by_noteable_type_and_id
(
type
,
id
,
parent_
id
)
target_type
=
type
.
name
.
underscore
{
target_type:
target_type
}.
tap
do
|
h
|
if
%w(issue merge_request)
.
include?
(
target_type
)
...
...
@@ -89,9 +89,15 @@ module API
else
h
[
:target_id
]
=
id
end
add_parent_to_finder_params
(
h
,
type
,
parent_id
)
end
end
def
add_parent_to_finder_params
(
finder_params
,
noteable_type
,
parent_id
)
finder_params
[
:project
]
=
user_project
end
def
noteable_parent
(
noteable
)
public_send
(
"user_
#{
noteable
.
class
.
parent_class
.
to_s
.
underscore
}
"
)
# rubocop:disable GitlabSecurity/PublicSend
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