summaryrefslogtreecommitdiff
path: root/app/services/projects/participants_service.rb
blob: eb0472c60249bd8480a85218dbd0483692031229 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Projects
  class ParticipantsService < BaseService
    include Users::ParticipableService

    def execute(noteable)
      @noteable = noteable

      project_members = sorted(project.team.members)
      participants = noteable_owner + participants_in_noteable + all_members + groups + project_members
      participants.uniq
    end

    def all_members
      count = project.team.members.flatten.count
      [{ username: "all", name: "All Project and Group Members", count: count }]
    end
  end
end