8a5ad3ca00
In Rails 5 `project.team.members` returns a CollectionProxy instead of array, which causes that `.flatten` fails. Although we could update the call to get distinct count directly with sql query, in this case it's better to re-use the list of members which is being loaded anyway.
20 lines
513 B
Ruby
20 lines
513 B
Ruby
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
|