Class: Projects::ParticipantsService

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

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from Users::ParticipableService

#groups, #noteable_owner, #participants_in_noteable, #sorted

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 BaseService

Instance Method Details

#all_membersObject


32
33
34
# File 'app/services/projects/participants_service.rb', line 32

def all_members
  [{ username: "all", name: "All Project and Group Members", count: project_members.count }]
end

#execute(noteable) ⇒ Object


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

def execute(noteable)
  @noteable = noteable

  participants =
    noteable_owner +
    participants_in_noteable +
    all_members +
    groups +
    project_members

  participants.uniq
end

#get_project_membersObject


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

def get_project_members
  members = Member.from_union([project_members_through_ancestral_groups,
                               project_members_through_invited_groups,
                               individual_project_members])

  User.id_in(members.select(:user_id))
end

#project_membersObject


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

def project_members
  @project_members ||= sorted(get_project_members)
end