Commit 182685eb2b62c217e7cfdd4d21cd4f9c8689a4ac
1 parent
3776461b
Exists in
master
and in
29 other branches
[template-welcome-page] Not copy templates welcome-page
(ActionItem3075)
Showing
2 changed files
with
16 additions
and
1 deletions
Show diff stats
app/models/profile.rb
@@ -605,7 +605,7 @@ private :generate_url, :url_options | @@ -605,7 +605,7 @@ private :generate_url, :url_options | ||
605 | end | 605 | end |
606 | 606 | ||
607 | def copy_article_tree(article, parent=nil) | 607 | def copy_article_tree(article, parent=nil) |
608 | - return if article.is_a?(RssFeed) | 608 | + return if !copy_article?(article) |
609 | original_article = self.articles.find_by_name(article.name) | 609 | original_article = self.articles.find_by_name(article.name) |
610 | if original_article | 610 | if original_article |
611 | num = 2 | 611 | num = 2 |
@@ -625,6 +625,11 @@ private :generate_url, :url_options | @@ -625,6 +625,11 @@ private :generate_url, :url_options | ||
625 | end | 625 | end |
626 | end | 626 | end |
627 | 627 | ||
628 | + def copy_article?(article) | ||
629 | + !article.is_a?(RssFeed) && | ||
630 | + !(is_template && article.slug=='welcome-page') | ||
631 | + end | ||
632 | + | ||
628 | # Adds a person as member of this Profile. | 633 | # Adds a person as member of this Profile. |
629 | def add_member(person) | 634 | def add_member(person) |
630 | if self.has_members? | 635 | if self.has_members? |
test/unit/profile_test.rb
@@ -1955,4 +1955,14 @@ class ProfileTest < ActiveSupport::TestCase | @@ -1955,4 +1955,14 @@ class ProfileTest < ActiveSupport::TestCase | ||
1955 | p = fast_create(Profile) | 1955 | p = fast_create(Profile) |
1956 | assert p.folder_types.include?('ProfileTest::Folder1') | 1956 | assert p.folder_types.include?('ProfileTest::Folder1') |
1957 | end | 1957 | end |
1958 | + | ||
1959 | + should 'not copy rss_feed' do | ||
1960 | + assert !fast_create(Profile).copy_article?(fast_create(RssFeed)) | ||
1961 | + end | ||
1962 | + | ||
1963 | + should 'not copy template welcome_page' do | ||
1964 | + template = fast_create(Person, :is_template => true) | ||
1965 | + welcome_page = fast_create(TinyMceArticle, :slug => 'welcome-page', :profile_id => template.id) | ||
1966 | + assert !template.copy_article?(welcome_page) | ||
1967 | + end | ||
1958 | end | 1968 | end |