Two Bugs
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:
parent
074599fc9b
commit
bdcb506418
3 changed files with 10 additions and 4 deletions
|
@ -27,6 +27,7 @@ class WebSweeper < ActionController::Caching::Sweeper
|
||||||
expire_cached_summary_pages(record)
|
expire_cached_summary_pages(record)
|
||||||
else
|
else
|
||||||
expire_cached_page(record.web, record.name)
|
expire_cached_page(record.web, record.name)
|
||||||
|
expire_cached_summary_pages(record.web)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,9 @@ class PageSet < Array
|
||||||
if never_orphans.include? page.name
|
if never_orphans.include? page.name
|
||||||
false
|
false
|
||||||
else
|
else
|
||||||
references = pages_that_reference(page.name)
|
# references = pages_that_reference(page.name)
|
||||||
references.empty? or references == [page]
|
references = WikiReference.pages_that_reference(@web, page.name)
|
||||||
|
references.empty? or references == [page.name]
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -79,12 +79,16 @@ class WebTest < Test::Unit::TestCase
|
||||||
'This is an author page, it should not be an orphan',
|
'This is an author page, it should not be an orphan',
|
||||||
Time.local(2004, 4, 4, 16, 50), 'AlexeyVerkhovsky', test_renderer)
|
Time.local(2004, 4, 4, 16, 50), 'AlexeyVerkhovsky', test_renderer)
|
||||||
self_linked = @web.add_page('SelfLinked',
|
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)
|
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
|
# page that links to itself, and nobody else links to it must be an orphan
|
||||||
assert_equal ['EverBeenHated', 'SelfLinked'],
|
assert_equal ['EverBeenHated', 'SelfLinked'],
|
||||||
@web.select.orphaned_pages.collect{ |page| page.name }.sort
|
@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
|
end
|
||||||
|
|
||||||
def test_page_names_by_author
|
def test_page_names_by_author
|
||||||
|
@ -98,7 +102,7 @@ class WebTest < Test::Unit::TestCase
|
||||||
private
|
private
|
||||||
|
|
||||||
def add_sample_pages
|
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)
|
Time.local(2004, 4, 4, 16, 50), 'DavidHeinemeierHansson', test_renderer)
|
||||||
@hated = @web.add_page('EverBeenHated', 'I am me EverBeenHated',
|
@hated = @web.add_page('EverBeenHated', 'I am me EverBeenHated',
|
||||||
Time.local(2004, 4, 4, 16, 51), 'DavidHeinemeierHansson', test_renderer)
|
Time.local(2004, 4, 4, 16, 51), 'DavidHeinemeierHansson', test_renderer)
|
||||||
|
|
Loading…
Add table
Reference in a new issue