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

    def execute(noteable)
      @noteable = noteable

      participants = noteable_owner + participants_in_noteable + all_members + groups + project_members
      participants.uniq
    end

    def project_members
      @project_members ||= sorted(project.team.members)
    end

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