From 8502ce1effd6b03a030ac535e13d46960b74ea44 Mon Sep 17 00:00:00 2001 From: Joenio Costa Date: Tue, 30 Dec 2008 20:47:44 -0300 Subject: [PATCH] ActionItem862: not display add friend button if user already friend --- app/models/person.rb | 4 ++++ app/views/blocks/profile_info_actions/person.rhtml | 2 +- test/functional/profile_controller_test.rb | 10 ++++++++++ test/unit/person_test.rb | 13 +++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/app/models/person.rb b/app/models/person.rb index 7e8c8c3..e52bc76 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -215,4 +215,8 @@ class Person < Profile organization.tasks.pending.select{|task| self.has_permission?(task.permission, organization)} end + def is_a_friend?(person) + self.friends.include?(person) + end + end diff --git a/app/views/blocks/profile_info_actions/person.rhtml b/app/views/blocks/profile_info_actions/person.rhtml index d43cc65..cf7854a 100644 --- a/app/views/blocks/profile_info_actions/person.rhtml +++ b/app/views/blocks/profile_info_actions/person.rhtml @@ -1,6 +1,6 @@