Class: Projects::ParticipantsService

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

Constant Summary

Constants included from Users::ParticipableService

Users::ParticipableService::SEARCH_LIMIT

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?, #can_all?, #can_any?

Constructor Details

This class inherits a constructor from BaseService

Instance Method Details

#all_membersObject



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

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

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

#execute(noteable) ⇒ Object



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

def execute(noteable)
  @noteable = noteable

  participants =
    noteable_owner +
    participants_in_noteable +
    all_members +
    project_members

  participants += groups unless relation_at_search_limit?(project_members)

  render_participants_as_hash(participants.uniq)
end

#project_membersObject



22
23
24
# File 'app/services/projects/participants_service.rb', line 22

def project_members
  filter_and_sort_users(project_members_relation)
end

#project_members_relationObject



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

def project_members_relation
  project.authorized_users
end