Merge pull request #4243 from davexunit/feature/2948

Show the user if a contact is sharing with them when viewing their profile page
This commit is contained in:
Jonne Haß 2013-06-29 10:15:49 +02:00
commit 30dff802d5
6 changed files with 45 additions and 1 deletions

View file

@ -8,6 +8,7 @@
## Features ## Features
* Admin: add option to find users under 13 (COPPA) [#4252](https://github.com/diaspora/diaspora/pull/4252) * 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 # 0.1.1.0

View file

@ -622,6 +622,17 @@ form.new_comment
h4 h4
:font-weight bold :font-weight bold
#sharing_message
:font-size smaller
:align middle
span
:vertical-align middle
img
:vertical-align middle
:margin 0.5em
#photo_container #photo_container
:text :text
:align center :align center

View file

@ -87,4 +87,13 @@ module PeopleHelper
return Rails.application.routes.url_helpers.person_path(person, opts) return Rails.application.routes.url_helpers.person_path(person, opts)
end end
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 end

View file

@ -8,6 +8,8 @@
- if user_signed_in? - if user_signed_in?
- if person != current_user.person - if person != current_user.person
= sharing_message(@person, @contact)
- if @contact && @contact.receiving? - if @contact && @contact.receiving?
%br %br
= link_to t('people.show.mention'), new_status_message_path(:person_id => @person.id), :class => 'button', :rel => 'facebox' = link_to t('people.show.mention'), new_status_message_path(:person_id => @person.id), :class => 'button', :rel => 'facebox'

View file

@ -594,6 +594,7 @@ en:
helper: helper:
results_for: " results for %{params}" results_for: " results for %{params}"
people_on_pod_are_aware_of: " people on pod are aware of" people_on_pod_are_aware_of: " people on pod are aware of"
is_sharing: "%{name} is sharing with you"
aspect_list: aspect_list:
edit_membership: "edit aspect membership" edit_membership: "edit aspect membership"
add_contact_small: add_contact_small:

View file

@ -117,5 +117,25 @@ describe PeopleHelper do
local_or_remote_person_path(@person).should == person_path(@person) local_or_remote_person_path(@person).should == person_path(@person)
end end
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