Commit d8630870e9ef1f92e54acc3e7302ec684b2705e6

Authored by Antonio Terceiro
1 parent 93ad499d

ActionItem949: don't list RSS feeds in "recent content"

app/models/article.rb
... ... @@ -98,7 +98,7 @@ class Article < ActiveRecord::Base
98 98 public_article = ? AND
99 99 published = ? AND
100 100 profiles.public_profile = ? AND
101   - (articles.type != ? OR articles.type is NULL)", true, true, true, true, 'UploadedFile'
  101 + ((articles.type != ? and articles.type != ?) OR articles.type is NULL)", true, true, true, true, 'UploadedFile', 'RssFeed'
102 102 ],
103 103 :include => 'profile',
104 104 :order => 'articles.updated_at desc, articles.id desc'
... ...
test/functional/profile_controller_test.rb
... ... @@ -154,14 +154,6 @@ class ProfileControllerTest < Test::Unit::TestCase
154 154 assert_tag :tag => 'div', :content => 'Recent content', :attributes => { :class => 'block recent-documents-block' }, :child => { :tag => 'ul', :content => /#{person.home_page.name}/ }
155 155 end
156 156  
157   - should 'show feed on recent content after update' do
158   - person = create_user('person_1').person
159   - person.articles.find_by_path('feed').name = 'Changed name'
160   - assert person.articles.find_by_path('feed').save!
161   - get :index, :profile => person.identifier
162   - assert_tag :tag => 'div', :content => 'Recent content', :attributes => { :class => 'block recent-documents-block' }, :child => { :tag => 'ul', :content => /#{person.articles.find_by_path('feed').name}/ }
163   - end
164   -
165 157 should 'display tag for profile' do
166 158 @profile.articles.create!(:name => 'testarticle', :tag_list => 'tag1')
167 159  
... ...
test/unit/article_test.rb
... ... @@ -207,6 +207,16 @@ class ArticleTest < Test::Unit::TestCase
207 207 assert_equal [ second ], Article.recent(nil)
208 208 end
209 209  
  210 + should 'not show RssFeed as recent' do
  211 + p = create_user('usr1').person
  212 + Article.destroy_all
  213 + first = RssFeed.create!(:profile => p, :name => 'my feed', :advertise => true)
  214 + first.limit = 10; first.save!
  215 + second = p.articles.build(:name => 'second'); second.save!
  216 +
  217 + assert_equal [ second ], Article.recent(nil)
  218 + end
  219 +
210 220 should 'require that subclasses define description' do
211 221 assert_raise NotImplementedError do
212 222 Article.description
... ...
test/unit/recent_documents_block_test.rb
... ... @@ -44,21 +44,6 @@ class RecentDocumentsBlockTest < Test::Unit::TestCase
44 44 assert_no_match /href=.*\/testinguser\/first/, output
45 45 end
46 46  
47   - should 'not list rss feed articles automatically created' do
48   - assert_equal 'feed', profile.articles.find_by_path('feed').name
49   - output = block.content
50   - assert_match /href=.*\/testinguser\/first/, output
51   - assert_no_match /href=.*\/testinguser\/feed/, output
52   - end
53   -
54   - should 'list rss feed articles after update' do
55   - profile.articles.find_by_path('feed').name = 'chaged name'
56   - assert profile.articles.find_by_path('feed').save!
57   - output = block.content
58   - assert_match /href=.*\/testinguser\/first/, output
59   - assert_match /href=.*\/testinguser\/feed/, output
60   - end
61   -
62 47 should 'display a link to sitemap with title "All content"' do
63 48 expects(:link_to).with('All content', :controller => 'profile', :action => 'sitemap', :profile => profile.identifier)
64 49 expects(:_).with('All content').returns('All content')
... ...