Commit 8afe63e2653ee34de27d92e7799f0011ec2260f1
1 parent
bccf7c42
Exists in
master
and in
29 other branches
ActionItem738: made copied aritcle from templates not advertised
Showing
2 changed files
with
16 additions
and
1 deletions
Show diff stats
app/models/profile.rb
| ... | ... | @@ -355,7 +355,7 @@ class Profile < ActiveRecord::Base |
| 355 | 355 | end |
| 356 | 356 | |
| 357 | 357 | def copy_article_tree(article, parent=nil) |
| 358 | - article_copy = article.copy(:profile => self, :parent => parent) | |
| 358 | + article_copy = article.copy(:profile => self, :parent => parent, :advertise => false) | |
| 359 | 359 | if article.profile.home_page == article |
| 360 | 360 | self.home_page = article_copy |
| 361 | 361 | end | ... | ... |
test/unit/profile_test.rb
| ... | ... | @@ -854,6 +854,21 @@ class ProfileTest < Test::Unit::TestCase |
| 854 | 854 | assert_not_nil p.home_page |
| 855 | 855 | assert_equal 'some xyz article', p.home_page.name |
| 856 | 856 | end |
| 857 | + | |
| 858 | + should 'not advertise the articles copied from templates' do | |
| 859 | + template = create_user('test_template').person | |
| 860 | + template.articles.destroy_all | |
| 861 | + a = template.articles.create(:name => 'some xyz article') | |
| 862 | + | |
| 863 | + Profile.any_instance.stubs(:template).returns(template) | |
| 864 | + | |
| 865 | + p = Profile.create!(:name => 'test_profile', :identifier => 'test_profile') | |
| 866 | + p.reload | |
| 867 | + | |
| 868 | + a_copy = p.articles[0] | |
| 869 | + | |
| 870 | + assert !a_copy.advertise | |
| 871 | + end | |
| 857 | 872 | |
| 858 | 873 | should 'copy set of boxes from profile template' do |
| 859 | 874 | template = Profile.create!(:name => 'test template', :identifier => 'test_template') | ... | ... |