Build noteables in AutocompleteSourcesController#target
This commit is contained in:
parent
4779c43ef9
commit
d23fbbc692
|
@ -34,9 +34,9 @@ class Projects::AutocompleteSourcesController < Projects::ApplicationController
|
|||
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
|
||||
|
|
|
@ -47,15 +47,7 @@ module Projects
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue