Commit 1a2951afacb28652030f2c97b93c20b785f4b7bf

Authored by Antonio Terceiro
1 parent d3227afd

ExternalFeed: use feed title as author name

app/models/external_feed.rb
... ... @@ -30,6 +30,7 @@ class ExternalFeed < ActiveRecord::Base
30 30 article.source = link
31 31 article.profile = blog.profile
32 32 article.parent = blog
  33 + article.author_name = self.feed_title
33 34 unless blog.children.exists?(:slug => article.slug)
34 35 article.save!
35 36 article.delay.create_activity
... ...
test/unit/external_feed_test.rb
... ... @@ -167,4 +167,13 @@ class ExternalFeedTest < ActiveSupport::TestCase
167 167 assert_equal '<img src="noosfero.png" /><p>Html content 1.</p><p>Html content 2.</p>', dd.sort.join
168 168 end
169 169  
  170 + should 'use feed title as author name' do
  171 + blog = create_blog
  172 + e = build(:external_feed, :blog => blog, :feed_title => 'The Source')
  173 + e.add_item('Article title', 'http://orig.link.invalid', Time.now, '<p style="color: red">Html content 1.</p>')
  174 +
  175 + assert_equal "The Source", blog.posts.first.author_name
  176 +
  177 + end
  178 +
170 179 end
... ...