diff options
| author | Sean McGivern <sean@gitlab.com> | 2016-08-18 22:50:28 +0100 |
|---|---|---|
| committer | Sean McGivern <sean@gitlab.com> | 2016-08-18 22:50:28 +0100 |
| commit | aba9cc6f227a670390cbac0c5da97784afefc5ee (patch) | |
| tree | 4eaafa3fb7fc948361a63b8b24170d69bddeeced /app/controllers/projects_controller.rb | |
| parent | 883b96ab6a77175d9bac7f03c325428327359cdd (diff) | |
| parent | 717366d28da11acc6dbe60301bf7e2394400b3c1 (diff) | |
| download | gitlab-ce-aba9cc6f227a670390cbac0c5da97784afefc5ee.tar.gz | |
Merge branch 'master' into expiration-date-on-memberships
Diffstat (limited to 'app/controllers/projects_controller.rb')
| -rw-r--r-- | app/controllers/projects_controller.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 47efbd4a939..fc52cd2f367 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -134,10 +134,22 @@ class ProjectsController < Projects::ApplicationController end def autocomplete_sources - note_type = params['type'] - note_id = params['type_id'] + noteable = + case params[:type] + when 'Issue' + IssuesFinder.new(current_user, project_id: @project.id, state: 'all'). + execute.find_by(iid: params[:type_id]) + when 'MergeRequest' + MergeRequestsFinder.new(current_user, project_id: @project.id, state: 'all'). + execute.find_by(iid: params[:type_id]) + when 'Commit' + @project.commit(params[:type_id]) + else + nil + end + autocomplete = ::Projects::AutocompleteService.new(@project, current_user) - participants = ::Projects::ParticipantsService.new(@project, current_user).execute(note_type, note_id) + participants = ::Projects::ParticipantsService.new(@project, current_user).execute(noteable) @suggestions = { emojis: Gitlab::AwardEmoji.urls, @@ -145,7 +157,8 @@ class ProjectsController < Projects::ApplicationController milestones: autocomplete.milestones, mergerequests: autocomplete.merge_requests, labels: autocomplete.labels, - members: participants + members: participants, + commands: autocomplete.commands(noteable, params[:type]) } respond_to do |format| |
