diff --git a/app/models/recent_documents_block.rb b/app/models/recent_documents_block.rb index 6b58456..652c480 100644 --- a/app/models/recent_documents_block.rb +++ b/app/models/recent_documents_block.rb @@ -16,6 +16,8 @@ class RecentDocumentsBlock < Block end def footer + return nil unless self.owner.is_a?(Profile) + profile = self.owner lambda do link_to _('All content'), :profile => profile.identifier, :controller => 'profile', :action => 'sitemap' diff --git a/test/unit/recent_documents_block_test.rb b/test/unit/recent_documents_block_test.rb index 91f9e56..ede23d9 100644 --- a/test/unit/recent_documents_block_test.rb +++ b/test/unit/recent_documents_block_test.rb @@ -62,4 +62,12 @@ class RecentDocumentsBlockTest < Test::Unit::TestCase instance_eval(&(block.footer)) end + should 'not display link to sitemap when owner is environment' do + block = RecentDocumentsBlock.new + box = mock + block.expects(:box).returns(box).at_least_once + box.expects(:owner).returns(Environment.new).at_least_once + assert_equal nil, block.footer + end + end -- libgit2 0.21.2