Mercurial > hg > soundsoftware-site
diff app/helpers/my_helper.rb @ 1217:875b5b4c574d cannam
Add "People I'm working with" as My Page box -- currently off by default
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Tue, 12 Mar 2013 13:01:36 +0000 |
parents | cbb26bc654de |
children | 30c444ea1338 |
line wrap: on
line diff
--- a/app/helpers/my_helper.rb Tue Mar 12 10:30:38 2013 +0000 +++ b/app/helpers/my_helper.rb Tue Mar 12 13:01:36 2013 +0000 @@ -18,4 +18,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. module MyHelper + +def all_colleagues_of(user) + # Return a list of all user ids who have worked with the given user + # (on projects that are visible to the current user) + user.projects.select { |p| p.visible? }.map { |p| p.members.map { |m| m.user_id } }.flatten.sort.uniq.reject { |i| user.id == i } end + +end