At mention participating users.
This commit is contained in:
parent
81527e9fba
commit
01ec6c793c
|
@ -123,11 +123,12 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def autocomplete_sources
|
||||
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 } }
|
||||
@suggestions = {
|
||||
emojis: Emoji.names.map { |e| { name: e, path: view_context.image_url("emoji/#{e}.png") } },
|
||||
issues: @project.issues.select([:iid, :title, :description]),
|
||||
mergerequests: @project.merge_requests.select([:iid, :title, :description]),
|
||||
members: @project.team.members.sort_by(&:username).map { |user| { username: user.username, name: user.name } }
|
||||
members: participating_users.uniq
|
||||
}
|
||||
|
||||
respond_to do |format|
|
||||
|
|
|
@ -169,6 +169,7 @@ class User < ActiveRecord::Base
|
|||
scope :not_in_project, ->(project) { project.users.present? ? where("id not in (:ids)", ids: project.users.map(&:id) ) : all }
|
||||
scope :without_projects, -> { where('id NOT IN (SELECT DISTINCT(user_id) FROM users_projects)') }
|
||||
scope :ldap, -> { where(provider: 'ldap') }
|
||||
scope :participating, ->(notes){ where(id: notes.inc_author.map(&:author_id))}
|
||||
|
||||
scope :potential_team_members, ->(team) { team.members.any? ? active.not_in_team(team) : active }
|
||||
|
||||
|
|
Loading…
Reference in New Issue