diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-02-25 19:34:01 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-02-25 19:34:01 +0300 |
commit | a672b4688309dc356922bd3f9c61b8ae9de018f8 (patch) | |
tree | b26abaee4ed1c511247701b3e7c31ab7bedabe4b /app/services | |
parent | a30a56634d3ea44ccfc69c037324b502456f9aba (diff) |
Include number of affected people in all/group mention autocomplete item.
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/projects/participants_service.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/services/projects/participants_service.rb b/app/services/projects/participants_service.rb index 0be50fed7cc..f6f9aceef95 100644 --- a/app/services/projects/participants_service.rb +++ b/app/services/projects/participants_service.rb @@ -35,15 +35,21 @@ module Projects end def sorted(users) - users.uniq.to_a.compact.sort_by(&:username).map { |user| { username: user.username, name: user.name } } + users.uniq.to_a.compact.sort_by(&:username).map do |user| + { username: user.username, name: user.name } + end end def groups - @user.authorized_groups.sort_by(&:path).map { |group| { username: group.path, name: group.name } } + @user.authorized_groups.sort_by(&:path).map do |group| + count = group.users.count + { username: group.path, name: "#{group.name} (#{count})" } + end end def all_members - [{ username: "all", name: "Project and Group Members" }] + count = @project.team.members.flatten.count + [{ username: "all", name: "All Project and Group Members (#{count})" }] end end end |