提交 8a5ad3ca 编写于 作者: J Jan Provaznik

Fix project team members count

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.
上级 c5adf04c
......@@ -5,14 +5,16 @@ module Projects
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 project_members
@project_members ||= sorted(project.team.members)
end
def all_members
count = project.team.members.flatten.count
[{ username: "all", name: "All Project and Group Members", count: count }]
[{ username: "all", name: "All Project and Group Members", count: project_members.count }]
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册