diff options
author | João Cunha <j.a.cunha@gmail.com> | 2019-02-26 10:33:32 +0000 |
---|---|---|
committer | João Cunha <j.a.cunha@gmail.com> | 2019-02-26 10:33:32 +0000 |
commit | ed7065bbdb6f6fad3cc8fb369267fa811767c8a5 (patch) | |
tree | b3fda377c51504a6d21da1742cac3de7fd668ef0 /app/services/concerns/users | |
parent | 26c7d04cd06d1126e4a4a7a1c9308d12de77172e (diff) | |
parent | 094d740886eaf62fd219dacd11aa9a966758a962 (diff) | |
download | gitlab-ce-ed7065bbdb6f6fad3cc8fb369267fa811767c8a5.tar.gz |
Merge branch 'master' into 56937-edit-knative-domain-after-it-has-been-deployed56937-edit-knative-domain-after-it-has-been-deployed
Diffstat (limited to 'app/services/concerns/users')
-rw-r--r-- | app/services/concerns/users/participable_service.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/app/services/concerns/users/participable_service.rb b/app/services/concerns/users/participable_service.rb index 5b408bd96c7..6713b6617ae 100644 --- a/app/services/concerns/users/participable_service.rb +++ b/app/services/concerns/users/participable_service.rb @@ -11,7 +11,7 @@ module Users def noteable_owner return [] unless noteable && noteable.author.present? - [as_hash(noteable.author)] + [user_as_hash(noteable.author)] end def participants_in_noteable @@ -23,21 +23,24 @@ module Users def sorted(users) users.uniq.to_a.compact.sort_by(&:username).map do |user| - as_hash(user) + user_as_hash(user) 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 } + group_as_hash(group) end end private - def as_hash(user) - { username: user.username, name: user.name, avatar_url: user.avatar_url } + def user_as_hash(user) + { type: user.class.name, username: user.username, name: user.name, avatar_url: user.avatar_url } + end + + def group_as_hash(group) + { type: group.class.name, username: group.full_path, name: group.full_name, avatar_url: group.avatar_url, count: group.users.count } end end end |