[Git][noosfero/noosfero][master] 2 commits: fix html escape of article in plugin comment paragraph

Leandro Nunes gitlab at mg.gitlab.com
Thu May 5 17:49:51 BRT 2016


Leandro Nunes pushed to branch master at Noosfero / noosfero


Commits:
4e618c2c by Leandro Nunes dos Santos at 2016-05-05T17:48:58-03:00
fix html escape of article in plugin comment paragraph

- - - - -
86688d49 by Leandro Nunes dos Santos at 2016-05-05T17:49:21-03:00
Merge branch 'master' of gitlab.com:noosfero/noosfero

- - - - -


2 changed files:

- plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb
- plugins/comment_paragraph/views/comment_paragraph_plugin_profile/_comment_paragraph.html.erb


Changes:

=====================================
plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb
=====================================
--- a/plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb
+++ b/plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb
@@ -26,4 +26,12 @@ class ContentViewerControllerTest < ActionController::TestCase
     assert_tag 'div', :attributes => {:class => 'comment_paragraph'}
   end
 
+  should 'parse article body with correct html escape' do
+    comment1 = fast_create(Comment, :paragraph_uuid => 0, :source_id => page.id)
+    @page.body='<p><strong>inner text</strong></p>'
+    @page.save
+    get :view_page, @page.url
+    assert_tag 'div', :content => 'inner text', :attributes => {:class => 'comment_paragraph'}
+  end
+
 end


=====================================
plugins/comment_paragraph/views/comment_paragraph_plugin_profile/_comment_paragraph.html.erb
=====================================
--- a/plugins/comment_paragraph/views/comment_paragraph_plugin_profile/_comment_paragraph.html.erb
+++ b/plugins/comment_paragraph/views/comment_paragraph_plugin_profile/_comment_paragraph.html.erb
@@ -1,7 +1,5 @@
 <div class="comment-paragraph-plugin comments" id="comment-paragraph-plugin_<%= paragraph_uuid %>" data-paragraph="<%= paragraph_uuid %>">
-  <div class="comment_paragraph">
-    <%= inner_html %>
-  </div>
+  <div class="comment_paragraph"><%= inner_html.html_safe %></div>
   <div class="side-comments-counter-container">
     <div class="side-comments-counter">
       <span class='comment-count-container <%= count==0 ? 'no-comments-yet':'' %>'>



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/025f806d0aa51a3b46979cb4fa2a75f3c2a40435...86688d4911a6a6a95f926c2d315fbce818862596
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160505/236ef38d/attachment-0001.html>


More information about the Noosfero-dev mailing list