Commit 2b2ce9f85416fb7b46cbce2cdbc20c7a51655bfa
1 parent
f1279433
Exists in
fix_cloned_article_parent
Fix cloned article body bug
Showing
2 changed files
with
13 additions
and
12 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
@@ -118,10 +118,7 @@ class CmsController < MyProfileController | @@ -118,10 +118,7 @@ class CmsController < MyProfileController | ||
118 | end | 118 | end |
119 | end | 119 | end |
120 | 120 | ||
121 | - unless @article.kind_of?(RssFeed) | ||
122 | - @escaped_body = CGI::escapeHTML(@article.body || '') | ||
123 | - @escaped_abstract = CGI::escapeHTML(@article.abstract || '') | ||
124 | - end | 121 | + escape_fields @article |
125 | end | 122 | end |
126 | 123 | ||
127 | def new | 124 | def new |
@@ -192,6 +189,8 @@ class CmsController < MyProfileController | @@ -192,6 +189,8 @@ class CmsController < MyProfileController | ||
192 | end | 189 | end |
193 | end | 190 | end |
194 | 191 | ||
192 | + escape_fields @article | ||
193 | + | ||
195 | render :action => 'edit' | 194 | render :action => 'edit' |
196 | end | 195 | end |
197 | 196 | ||
@@ -541,4 +540,10 @@ class CmsController < MyProfileController | @@ -541,4 +540,10 @@ class CmsController < MyProfileController | ||
541 | end | 540 | end |
542 | end | 541 | end |
543 | 542 | ||
543 | + def escape_fields article | ||
544 | + unless article.kind_of?(RssFeed) | ||
545 | + @escaped_body = CGI::escapeHTML(article.body || '') | ||
546 | + @escaped_abstract = CGI::escapeHTML(article.abstract || '') | ||
547 | + end | ||
548 | + end | ||
544 | end | 549 | end |
test/functional/cms_controller_test.rb
@@ -1839,14 +1839,6 @@ class CmsControllerTest < ActionController::TestCase | @@ -1839,14 +1839,6 @@ class CmsControllerTest < ActionController::TestCase | ||
1839 | assert_equal 'first version', assigns(:article).name | 1839 | assert_equal 'first version', assigns(:article).name |
1840 | end | 1840 | end |
1841 | 1841 | ||
1842 | - should 'clone article with its content' do | ||
1843 | - article = profile.articles.create(:name => 'first version') | ||
1844 | - | ||
1845 | - get :new, :profile => profile.identifier, :id => article.id, :clone => true, :type => 'TinyMceArticle' | ||
1846 | - | ||
1847 | - assert_match article.name, @response.body | ||
1848 | - end | ||
1849 | - | ||
1850 | should 'save article with content from older version' do | 1842 | should 'save article with content from older version' do |
1851 | article = profile.articles.create(:name => 'first version') | 1843 | article = profile.articles.create(:name => 'first version') |
1852 | article.name = 'second version'; article.save | 1844 | article.name = 'second version'; article.save |
@@ -1918,6 +1910,10 @@ class CmsControllerTest < ActionController::TestCase | @@ -1918,6 +1910,10 @@ class CmsControllerTest < ActionController::TestCase | ||
1918 | 1910 | ||
1919 | assert_equal main_article.parent_id, cloned_main_article.parent_id | 1911 | assert_equal main_article.parent_id, cloned_main_article.parent_id |
1920 | 1912 | ||
1913 | + get :new, :profile => profile.identifier, :id => cloned_main_article.id, | ||
1914 | + :clone => true, :type => 'TinyMceArticle' | ||
1915 | + | ||
1916 | + assert_match main_article.body, @response.body | ||
1921 | end | 1917 | end |
1922 | 1918 | ||
1923 | protected | 1919 | protected |