Commit b81854bf authored by Peter Leitzen's avatar Peter Leitzen
Browse files

Build noteables in AutocompleteSourcesController#target

parent 706466c886b1
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment