diff --git a/app/models/profile.rb b/app/models/profile.rb index 48d7188..b3e2e48 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -355,7 +355,7 @@ class Profile < ActiveRecord::Base end def copy_article_tree(article, parent=nil) - article_copy = article.copy(:profile => self, :parent => parent) + article_copy = article.copy(:profile => self, :parent => parent, :advertise => false) if article.profile.home_page == article self.home_page = article_copy end diff --git a/test/unit/profile_test.rb b/test/unit/profile_test.rb index 29560cd..eecb58d 100644 --- a/test/unit/profile_test.rb +++ b/test/unit/profile_test.rb @@ -854,6 +854,21 @@ class ProfileTest < Test::Unit::TestCase assert_not_nil p.home_page assert_equal 'some xyz article', p.home_page.name end + + should 'not advertise the articles copied from templates' do + template = create_user('test_template').person + template.articles.destroy_all + a = template.articles.create(:name => 'some xyz article') + + Profile.any_instance.stubs(:template).returns(template) + + p = Profile.create!(:name => 'test_profile', :identifier => 'test_profile') + p.reload + + a_copy = p.articles[0] + + assert !a_copy.advertise + end should 'copy set of boxes from profile template' do template = Profile.create!(:name => 'test template', :identifier => 'test_template') -- libgit2 0.21.2