comparison 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
comparison
equal deleted inserted replaced
1216:05ce7de07fef 1217:875b5b4c574d
16 # You should have received a copy of the GNU General Public License 16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software 17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 19
20 module MyHelper 20 module MyHelper
21
22 def all_colleagues_of(user)
23 # Return a list of all user ids who have worked with the given user
24 # (on projects that are visible to the current user)
25 user.projects.select { |p| p.visible? }.map { |p| p.members.map { |m| m.user_id } }.flatten.sort.uniq.reject { |i| user.id == i }
21 end 26 end
27
28 end