diff options
author | Peter Leitzen <pl@neopoly.de> | 2018-07-29 00:42:06 +0300 |
---|---|---|
committer | Peter Leitzen <pl@neopoly.de> | 2018-08-10 17:45:11 +0300 |
commit | 9b95fe78ae39aa2c0f9c3dc49b897097fc3fef5e (patch) | |
tree | a06e64b4da02a29644d44dff6db2c2c0e485197d /app/services/projects | |
parent | 19f97d2a0fe16b905f95dc17480fdbbfba4654d7 (diff) |
Move finding autocompletion targets into AutocompleteService
Diffstat (limited to 'app/services/projects')
-rw-r--r-- | app/services/projects/autocomplete_service.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/services/projects/autocomplete_service.rb b/app/services/projects/autocomplete_service.rb index 5286b92ab6b..d116ad11294 100644 --- a/app/services/projects/autocomplete_service.rb +++ b/app/services/projects/autocomplete_service.rb @@ -51,5 +51,16 @@ module Projects QuickActions::InterpretService.new(project, current_user).available_commands(noteable) end + + def target(type, type_id) + case type&.downcase + when 'issue' + IssuesFinder.new(current_user, project_id: project.id).find_by(iid: type_id) || project.issues.build + when 'mergerequest' + MergeRequestsFinder.new(current_user, project_id: project.id).find_by(iid: type_id) || project.merge_requests.build + when 'commit' + project.commit(type_id) + end + end end end |