Fix #3750
This commit is contained in:
parent
76bd782962
commit
abd4e17daf
3 changed files with 15 additions and 8 deletions
|
|
@ -39,8 +39,10 @@ module PeopleHelper
|
||||||
"<a data-hovercard='#{remote_or_hovercard_link}' #{person_href(person)} class='#{opts[:class]}' #{ ("target=" + opts[:target]) if opts[:target]}>#{h(person.name)}</a>".html_safe
|
"<a data-hovercard='#{remote_or_hovercard_link}' #{person_href(person)} class='#{opts[:class]}' #{ ("target=" + opts[:target]) if opts[:target]}>#{h(person.name)}</a>".html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def last_post_link(person)
|
def last_visible_post_for(person, current_user=nil)
|
||||||
link_to(t('people.last_post'), last_post_person_path(person.to_param)) unless person.posts.empty?
|
unless Post.visible_from_author(person, current_user).empty?
|
||||||
|
link_to(t('people.last_post'), last_post_person_path(person.to_param))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def person_image_tag(person, size = :thumb_small)
|
def person_image_tag(person, size = :thumb_small)
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
= person.name
|
= person.name
|
||||||
%span.diaspora_handle
|
%span.diaspora_handle
|
||||||
= person.diaspora_handle
|
= person.diaspora_handle
|
||||||
= last_post_link person
|
= last_visible_post_for person
|
||||||
|
|
||||||
.description
|
.description
|
||||||
- if !person.tag_string.blank? && user_signed_in?
|
- if !person.tag_string.blank? && user_signed_in?
|
||||||
|
|
|
||||||
|
|
@ -60,18 +60,23 @@ describe PeopleHelper do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#last_post_link' do
|
describe '#last_visible_post_for' do
|
||||||
before do
|
before do
|
||||||
@person = FactoryGirl.create(:person)
|
@person = FactoryGirl.create(:person)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't show a link, if the person has no posts" do
|
it "doesn't show a link, if the person has no visible posts" do
|
||||||
last_post_link(@person).should be_blank
|
last_visible_post_for(@person).should be_blank
|
||||||
end
|
end
|
||||||
|
|
||||||
it "shows the link, if the person has at leas one post" do
|
it "doesn't show a link, if the person has posts but none visible" do
|
||||||
post = FactoryGirl.create(:status_message, :author => @person)
|
post = FactoryGirl.create(:status_message, :author => @person)
|
||||||
last_post_link(@person).should include last_post_person_path(@person.to_param)
|
last_visible_post_for(@person).should be_blank
|
||||||
|
end
|
||||||
|
|
||||||
|
it "shows the link, if the person has at least one visible post" do
|
||||||
|
post = FactoryGirl.create(:status_message, :author => @person, :public => true)
|
||||||
|
last_visible_post_for(@person).should include last_post_person_path(@person.to_param)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue