[Git][noosfero/noosfero][master] external-feed: add limit to title

Rodrigo Souto gitlab at mg.gitlab.com
Mon Apr 1 10:40:37 BRT 2019



Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
cb8faa28 by Rodrigo Souto at 2019-04-01T13:40:28Z
external-feed: add limit to title

- - - - -


2 changed files:

- app/models/external_feed.rb
- test/models/external_feed_test.rb


Changes:

=====================================
app/models/external_feed.rb
=====================================
@@ -26,7 +26,7 @@ class ExternalFeed < ApplicationRecord
     content = doc.to_s
 
     article = TextArticle.new
-    article.name = title
+    article.name = title[0..149]
     article.profile = blog.profile
     article.body = content
     article.published_at = date


=====================================
test/models/external_feed_test.rb
=====================================
@@ -187,4 +187,12 @@ class ExternalFeedTest < ActiveSupport::TestCase
     end
   end
 
+  should 'limit feed title to ensure name size limit' do
+    blog = create_blog
+    e = build(:external_feed, :blog => blog, :feed_title => 'The Source')
+    assert_nothing_raised do
+      e.add_item('A'*180, 'http://orig.link.invalid', Time.now, '<p style="color: red">Html content 1.</p>')
+    end
+  end
+
 end



View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/cb8faa281480e05856290099b15f99b54d9a9afe

-- 
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/cb8faa281480e05856290099b15f99b54d9a9afe
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20190401/6d237a1b/attachment.html>


More information about the Noosfero-dev mailing list