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 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



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

def all_members
  return [] if Feature.enabled?(:disable_all_mention)

  [{ 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

  render_participants_as_hash(participants.uniq)
end

#project_membersObject



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

def project_members
  @project_members ||= sorted(project.authorized_users)
end