1) Orphaned pages in a Category were not being listed correctly
2) "list" view was not being expired correctly on deletion of orphaned pages.
This commit is contained in:
Jacques Distler 2009-01-01 02:38:12 -06:00
parent 074599fc9b
commit bdcb506418
3 changed files with 10 additions and 4 deletions

View file

@ -27,6 +27,7 @@ class WebSweeper < ActionController::Caching::Sweeper
expire_cached_summary_pages(record)
else
expire_cached_page(record.web, record.name)
expire_cached_summary_pages(record.web)
end
end

View file

@ -67,8 +67,9 @@ class PageSet < Array
if never_orphans.include? page.name
false
else
references = pages_that_reference(page.name)
references.empty? or references == [page]
# references = pages_that_reference(page.name)
references = WikiReference.pages_that_reference(@web, page.name)
references.empty? or references == [page.name]
end
}
end

View file

@ -79,12 +79,16 @@ class WebTest < Test::Unit::TestCase
'This is an author page, it should not be an orphan',
Time.local(2004, 4, 4, 16, 50), 'AlexeyVerkhovsky', test_renderer)
self_linked = @web.add_page('SelfLinked',
'I am SelfLinked and link to EverBeenInLove',
"I am SelfLinked and link to EverBeenInLove\ncategory: fubar",
Time.local(2004, 4, 4, 16, 50), 'AnonymousCoward', test_renderer)
# page that links to itself, and nobody else links to it must be an orphan
assert_equal ['EverBeenHated', 'SelfLinked'],
@web.select.orphaned_pages.collect{ |page| page.name }.sort
pages_in_category = @web.select.pages_in_category('fubar')
orphaned_pages = @web.select.orphaned_pages
assert_equal ['SelfLinked'],
(pages_in_category & orphaned_pages).collect{ |page| page.name }.sort
end
def test_page_names_by_author
@ -98,7 +102,7 @@ class WebTest < Test::Unit::TestCase
private
def add_sample_pages
@in_love = @web.add_page('EverBeenInLove', 'Who am I me',
@in_love = @web.add_page('EverBeenInLove', "Who am I me\ncategory: fubar",
Time.local(2004, 4, 4, 16, 50), 'DavidHeinemeierHansson', test_renderer)
@hated = @web.add_page('EverBeenHated', 'I am me EverBeenHated',
Time.local(2004, 4, 4, 16, 51), 'DavidHeinemeierHansson', test_renderer)