diff --git a/Changelog.md b/Changelog.md index d4226106b..efa570700 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,7 @@ ## Features * Admin: add option to find users under 13 (COPPA) [#4252](https://github.com/diaspora/diaspora/pull/4252) +* Show the user if a contact is sharing with them when viewing their profile page [#2948](https://github.com/diaspora/diaspora/issues/2948) # 0.1.1.0 diff --git a/app/assets/stylesheets/application.css.sass b/app/assets/stylesheets/application.css.sass index c4eae479c..9c7ea04bc 100644 --- a/app/assets/stylesheets/application.css.sass +++ b/app/assets/stylesheets/application.css.sass @@ -622,6 +622,17 @@ form.new_comment h4 :font-weight bold + #sharing_message + :font-size smaller + :align middle + + span + :vertical-align middle + + img + :vertical-align middle + :margin 0.5em + #photo_container :text :align center diff --git a/app/helpers/people_helper.rb b/app/helpers/people_helper.rb index ef751f1c5..bf019f997 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, :id => 'sharing_message') 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/app/views/people/_profile_sidebar.html.haml b/app/views/people/_profile_sidebar.html.haml index 10bb9764f..4821a0965 100644 --- a/app/views/people/_profile_sidebar.html.haml +++ b/app/views/people/_profile_sidebar.html.haml @@ -8,6 +8,8 @@ - if user_signed_in? - if person != current_user.person + = sharing_message(@person, @contact) + - if @contact && @contact.receiving? %br = link_to t('people.show.mention'), new_status_message_path(:person_id => @person.id), :class => 'button', :rel => 'facebox' diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 98f874670..3abb63d87 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -594,6 +594,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