Commit eda2c0c607e4f12803d9021f9f2eacf56a4d2fcd
1 parent
02850210
Exists in
spb-stable
and in
3 other branches
Include commits.
Showing
2 changed files
with
24 additions
and
3 deletions
Show diff stats
app/controllers/projects_controller.rb
| @@ -123,12 +123,21 @@ class ProjectsController < ApplicationController | @@ -123,12 +123,21 @@ class ProjectsController < ApplicationController | ||
| 123 | end | 123 | end |
| 124 | 124 | ||
| 125 | def autocomplete_sources | 125 | def autocomplete_sources |
| 126 | - participating_users = @project.team.members.sort_by(&:username).map { |user| { username: user.username, name: user.name } } + User.participating(@project.notes).select([:username, :name]).sort_by(&:username).map { |user| { username: user.username, name: user.name } } | 126 | + note_type = params['type'] |
| 127 | + note_id = params['type_id'] | ||
| 128 | + participating = if note_type && note_id | ||
| 129 | + participants_in(note_type, note_id) | ||
| 130 | + else | ||
| 131 | + [] | ||
| 132 | + end | ||
| 133 | + team_members = @project.team.members.sort_by(&:username).map { |user| { username: user.username, name: user.name } } | ||
| 134 | + participants = team_members + participating | ||
| 135 | + #participating = @project.issues.map { |issue| issue.participants.sort_by(&:username).map { |user| { username: user.username, name: user.name } } }.flatten | ||
| 127 | @suggestions = { | 136 | @suggestions = { |
| 128 | emojis: Emoji.names.map { |e| { name: e, path: view_context.image_url("emoji/#{e}.png") } }, | 137 | emojis: Emoji.names.map { |e| { name: e, path: view_context.image_url("emoji/#{e}.png") } }, |
| 129 | issues: @project.issues.select([:iid, :title, :description]), | 138 | issues: @project.issues.select([:iid, :title, :description]), |
| 130 | mergerequests: @project.merge_requests.select([:iid, :title, :description]), | 139 | mergerequests: @project.merge_requests.select([:iid, :title, :description]), |
| 131 | - members: participating_users.uniq | 140 | + members: participants.uniq |
| 132 | } | 141 | } |
| 133 | 142 | ||
| 134 | respond_to do |format| | 143 | respond_to do |format| |
| @@ -163,4 +172,16 @@ class ProjectsController < ApplicationController | @@ -163,4 +172,16 @@ class ProjectsController < ApplicationController | ||
| 163 | def user_layout | 172 | def user_layout |
| 164 | current_user ? "projects" : "public_projects" | 173 | current_user ? "projects" : "public_projects" |
| 165 | end | 174 | end |
| 175 | + | ||
| 176 | + def participants_in(type, id) | ||
| 177 | + note = case type | ||
| 178 | + when "Issue", "MergeRequest" | ||
| 179 | + type.constantize.find_by_iid(id) | ||
| 180 | + when "Commits" | ||
| 181 | + type.constantize.find(id) | ||
| 182 | + else | ||
| 183 | + [] | ||
| 184 | + end | ||
| 185 | + note.participants.sort_by(&:username).map { |user| { username: user.username, name: user.name } } | ||
| 186 | + end | ||
| 166 | end | 187 | end |
app/views/layouts/_init_auto_complete.html.haml
| 1 | :javascript | 1 | :javascript |
| 2 | - GitLab.GfmAutoComplete.dataSource = "#{autocomplete_sources_project_path(@project)}" | 2 | + GitLab.GfmAutoComplete.dataSource = "#{autocomplete_sources_project_path(@project, type: @noteable.class, type_id: params[:id])}" |
| 3 | GitLab.GfmAutoComplete.setup(); | 3 | GitLab.GfmAutoComplete.setup(); |