Commit d7794fe7a28e72eecf5ce09762fe9bd3caa0bc6f
Exists in
staging
and in
1 other branch
merge with master
Showing
3 changed files
with
10 additions
and
4 deletions
Show diff stats
app/views/comment/_comment.html.erb
| ... | ... | @@ -38,7 +38,7 @@ |
| 38 | 38 | <div class="comment-created-at"> |
| 39 | 39 | <%= show_time(comment.created_at) %> |
| 40 | 40 | </div> |
| 41 | - <h4><%= comment.title.blank? && ' ' || sanitize(comment.title) %></h4> | |
| 41 | + <h4><%= comment.title.blank? && ' '.html_safe || sanitize(comment.title) %></h4> | |
| 42 | 42 | <div class="comment-text"> |
| 43 | 43 | <p/> |
| 44 | 44 | <%= txt2html sanitize(comment.body) %> | ... | ... |
plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb
| ... | ... | @@ -26,4 +26,12 @@ class ContentViewerControllerTest < ActionController::TestCase |
| 26 | 26 | assert_tag 'div', :attributes => {:class => 'comment_paragraph'} |
| 27 | 27 | end |
| 28 | 28 | |
| 29 | + should 'parse article body with correct html escape' do | |
| 30 | + comment1 = fast_create(Comment, :paragraph_uuid => 0, :source_id => page.id) | |
| 31 | + @page.body='<p><strong>inner text</strong></p>' | |
| 32 | + @page.save | |
| 33 | + get :view_page, @page.url | |
| 34 | + assert_tag 'div', :content => 'inner text', :attributes => {:class => 'comment_paragraph'} | |
| 35 | + end | |
| 36 | + | |
| 29 | 37 | end | ... | ... |
plugins/comment_paragraph/views/comment_paragraph_plugin_profile/_comment_paragraph.html.erb
| 1 | 1 | <div class="comment-paragraph-plugin comments" id="comment-paragraph-plugin_<%= paragraph_uuid %>" data-paragraph="<%= paragraph_uuid %>"> |
| 2 | - <div class="comment_paragraph"> | |
| 3 | - <%= inner_html %> | |
| 4 | - </div> | |
| 2 | + <div class="comment_paragraph"><%= inner_html.html_safe %></div> | |
| 5 | 3 | <div class="side-comments-counter-container"> |
| 6 | 4 | <div class="side-comments-counter"> |
| 7 | 5 | <span class='comment-count-container <%= count==0 ? 'no-comments-yet':'' %>'> | ... | ... |