diff --git a/app/views/profile/_create_article.html.erb b/app/views/profile/_create_article.html.erb index a4cdc1f..fcb2ce2 100644 --- a/app/views/profile/_create_article.html.erb +++ b/app/views/profile/_create_article.html.erb @@ -9,7 +9,7 @@
<%= link_to(activity.params['name'], activity.params['url']) %>
- <%= image_tag(activity.params['first_image']) unless activity.params['first_image'].blank? %><%= strip_tags(truncate(activity.params['lead'], :length => 1000, :ommision => '...')).gsub(/(\xC2\xA0|\s)+/, ' ').gsub(/^\s+/, '') unless activity.params['lead'].blank? %> <%= link_to(_('See more'), activity.params['url']) unless activity.get_lead.blank? %> + <%= image_tag(activity.params['first_image']) unless activity.params['first_image'].blank? %><%= strip_tags(truncate(activity.params['lead'].html_safe, :length => 1000, :ommision => '...')).gsub(/(\xC2\xA0|\s)+/, ' ').gsub(/^\s+/, '') unless activity.params['lead'].blank? %><%= link_to(_('See more'), activity.params['url']) unless activity.get_lead.blank? %>
<%= content_tag(:p, link_to(_('See complete forum'), activity.get_url), :class => 'see-forum') if activity.target.is_a?(Forum) %>

<%= time_ago_in_words(activity.created_at) %>

diff --git a/test/integration/safe_strings_test.rb b/test/integration/safe_strings_test.rb index 5e8b97d..3c5c4de 100644 --- a/test/integration/safe_strings_test.rb +++ b/test/integration/safe_strings_test.rb @@ -117,4 +117,22 @@ class SafeStringsTest < ActionDispatch::IntegrationTest get "/myprofile/jimi/cms/new?type=TinyMceArticle" assert_no_match /title: "Safestringstest::plugin1::macro"/, response.body end + + should 'not escape short_description of articles in activities' do + user = create_user('marley', :password => 'test', :password_confirmation => 'test') + user.activate + profile = user.person + login 'marley', 'test' + + expected_content = 'something' + html_content = "

#{expected_content}

" + article = TinyMceArticle.create!(:profile => profile, :name => 'An Article about Free Software', :body => html_content) + ActionTracker::Record.destroy_all + activity = create(ActionTracker::Record, :user_id => profile.id, :user_type => 'Profile', :verb => 'create_article', :target_id => article.id, :target_type => 'Article', :params => {'name' => article.name, 'url' => article.url, 'lead' => article.lead, 'first_image' => article.first_image}) + get "/profile/marley" + assert_tag 'li', :attributes => {:id => "profile-activity-item-#{activity.id}"}, :descendant => { + :tag => 'div', :content => "\n " + expected_content, :attributes => {:class => 'profile-activity-lead'} + } + end + end -- libgit2 0.21.2