diff --git a/app/helpers/people_helper.rb b/app/helpers/people_helper.rb index ef751f1c5..c823f4a8e 100644 --- a/app/helpers/people_helper.rb +++ b/app/helpers/people_helper.rb @@ -87,4 +87,13 @@ module PeopleHelper return Rails.application.routes.url_helpers.person_path(person, opts) end end + + def sharing_message(person, contact) + if contact.sharing? + content_tag(:div, :class => 'info') do + image_tag('icons/check_yes_ok.png') + + content_tag(:span, I18n.t('people.helper.is_sharing', :name => person.name)) + end + end + end end diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 1efd46ebf..6cb20ab04 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -593,6 +593,7 @@ en: helper: results_for: " results for %{params}" people_on_pod_are_aware_of: " people on pod are aware of" + is_sharing: "%{name} is sharing with you" aspect_list: edit_membership: "edit aspect membership" add_contact_small: diff --git a/spec/helpers/people_helper_spec.rb b/spec/helpers/people_helper_spec.rb index b8713e1da..e5e61f43e 100644 --- a/spec/helpers/people_helper_spec.rb +++ b/spec/helpers/people_helper_spec.rb @@ -117,5 +117,25 @@ describe PeopleHelper do local_or_remote_person_path(@person).should == person_path(@person) end end -end + describe '#sharing_message' do + before do + @contact = FactoryGirl.create(:contact, :person => @person) + end + + context 'when the contact is sharing' do + it 'shows the sharing message' do + message = I18n.t('people.helper.is_sharing', :name => @person.name) + @contact.stub(:sharing?).and_return(true) + sharing_message(@person, @contact).should include(message) + end + end + + context 'when the contact is not sharing' do + it 'does not show the sharing message' do + @contact.stub(:sharing?).and_return(false) + sharing_message(@person, @contact).should be_blank + end + end + end +end