summaryrefslogtreecommitdiff
path: root/app/services/projects
diff options
context:
space:
mode:
authorMario de la Ossa <mariodelaossa@gmail.com>2018-04-26 13:53:13 -0600
committerMario de la Ossa <mariodelaossa@gmail.com>2018-05-04 11:33:09 -0600
commit5c2078838bb9de710f9025513c4b6ec664bba313 (patch)
tree338656dae97b6c6687e6794b583b0ae431aa5e2f /app/services/projects
parente71351d4f463715fccd80ddbcb4dade67e80f34b (diff)
downloadgitlab-ce-5c2078838bb9de710f9025513c4b6ec664bba313.tar.gz
Backport of 4084-epics-username-autocomplete
Diffstat (limited to 'app/services/projects')
-rw-r--r--app/services/projects/participants_service.rb32
1 files changed, 1 insertions, 31 deletions
diff --git a/app/services/projects/participants_service.rb b/app/services/projects/participants_service.rb
index e6193fcacee..eb0472c6024 100644
--- a/app/services/projects/participants_service.rb
+++ b/app/services/projects/participants_service.rb
@@ -1,6 +1,6 @@
module Projects
class ParticipantsService < BaseService
- attr_reader :noteable
+ include Users::ParticipableService
def execute(noteable)
@noteable = noteable
@@ -10,36 +10,6 @@ module Projects
participants.uniq
end
- def noteable_owner
- return [] unless noteable && noteable.author.present?
-
- [{
- name: noteable.author.name,
- username: noteable.author.username,
- avatar_url: noteable.author.avatar_url
- }]
- end
-
- def participants_in_noteable
- return [] unless noteable
-
- users = noteable.participants(current_user)
- sorted(users)
- end
-
- def sorted(users)
- users.uniq.to_a.compact.sort_by(&:username).map do |user|
- { username: user.username, name: user.name, avatar_url: user.avatar_url }
- end
- end
-
- def groups
- current_user.authorized_groups.sort_by(&:path).map do |group|
- count = group.users.count
- { username: group.full_path, name: group.full_name, count: count, avatar_url: group.avatar_url }
- end
- end
-
def all_members
count = project.team.members.flatten.count
[{ username: "all", name: "All Project and Group Members", count: count }]