Class: Groups::ParticipantsService

Inherits:
BaseService show all
Includes:
Users::ParticipableService
Defined in:
app/services/groups/participants_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #group, #params

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Methods inherited from BaseService

#initialize

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

This class inherits a constructor from Groups::BaseService

Instance Method Details

#all_membersObject


20
21
22
23
# File 'app/services/groups/participants_service.rb', line 20

def all_members
  count = group_members.count
  [{ username: "all", name: "All Group Members", count: count }]
end

#execute(noteable) ⇒ Object


7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/services/groups/participants_service.rb', line 7

def execute(noteable)
  @noteable = noteable

  participants =
    noteable_owner +
    participants_in_noteable +
    all_members +
    groups +
    group_members

  render_participants_as_hash(participants.uniq)
end

#group_membersObject


25
26
27
28
29
# File 'app/services/groups/participants_service.rb', line 25

def group_members
  return [] unless group

  @group_members ||= sorted(group.direct_and_indirect_users)
end