Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
7a6eeeaabe66
Commit
b81854bf
authored
Jul 21, 2018
by
Peter Leitzen
Browse files
Build noteables in AutocompleteSourcesController#target
parent
706466c886b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/controllers/projects/autocomplete_sources_controller.rb
View file @
7a6eeeaa
...
...
@@ -34,9 +34,9 @@ def load_autocomplete_service
def
target
case
params
[
:type
]
&
.
downcase
when
'issue'
IssuesFinder
.
new
(
current_user
,
project_id:
@project
.
id
).
find_by
(
iid:
params
[
:type_id
])
IssuesFinder
.
new
(
current_user
,
project_id:
@project
.
id
).
find_by
(
iid:
params
[
:type_id
])
||
@project
.
issues
.
build
when
'mergerequest'
MergeRequestsFinder
.
new
(
current_user
,
project_id:
@project
.
id
).
find_by
(
iid:
params
[
:type_id
])
MergeRequestsFinder
.
new
(
current_user
,
project_id:
@project
.
id
).
find_by
(
iid:
params
[
:type_id
])
||
@project
.
merge_requests
.
build
when
'commit'
@project
.
commit
(
params
[
:type_id
])
end
...
...
app/services/projects/autocomplete_service.rb
View file @
7a6eeeaa
...
...
@@ -47,15 +47,7 @@ def labels_as_hash(target = nil)
end
def
commands
(
noteable
,
type
)
noteable
||=
case
type
when
'Issue'
@project
.
issues
.
build
when
'MergeRequest'
@project
.
merge_requests
.
build
end
return
[]
unless
noteable
&
.
is_a?
(
Issuable
)
return
[]
unless
noteable
QuickActions
::
InterpretService
.
new
(
project
,
current_user
).
available_commands
(
noteable
)
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