diff --git a/app/controllers/cache_sweeping_helper.rb b/app/controllers/cache_sweeping_helper.rb index 5f8fb724..f91ec909 100644 --- a/app/controllers/cache_sweeping_helper.rb +++ b/app/controllers/cache_sweeping_helper.rb @@ -4,7 +4,7 @@ module CacheSweepingHelper expire_action :controller => 'wiki', :web => web.address, :action => %w(show published s5 tex print history), :id => page_name expire_action :controller => 'wiki', :web => web.address, - :action => %w(show published), :id => page_name, :mode => 'diff' + :action => 'show', :id => page_name, :mode => 'diff' end def expire_cached_summary_pages(web) @@ -25,4 +25,14 @@ module CacheSweepingHelper end end + def expire_cached_revisions(page) + page.revisions.length.times do |i| + revno = i+1 + expire_action :controller => 'wiki', :web => page.web.address, + :action => 'revision', :id => page.name, :rev => revno + expire_action :controller => 'wiki', :web => page.web.address, + :action => 'revision', :id => page.name, :rev => revno, :mode => 'diff' + end + end + end diff --git a/app/controllers/web_sweeper.rb b/app/controllers/web_sweeper.rb index d60c2823..838aa328 100644 --- a/app/controllers/web_sweeper.rb +++ b/app/controllers/web_sweeper.rb @@ -25,6 +25,7 @@ class WebSweeper < ActionController::Caching::Sweeper elsif record.is_a?(Page) expire_cached_page(record.web, record.name) expire_cached_summary_pages(record.web) + expire_cached_revisions(record) else expire_cached_summary_pages(record.web) end diff --git a/app/views/wiki/history.html.erb b/app/views/wiki/history.html.erb index 94b3e9b2..be0b7d2d 100644 --- a/app/views/wiki/history.html.erb +++ b/app/views/wiki/history.html.erb @@ -12,8 +12,10 @@ "Revision #{@revision_numbers[rev.id]}" ) ) %> <%- if @revision_numbers[rev.id] > 1 -%> + (<%= link_to_revision(rev.page, @revision_numbers[rev.id], text="diff", mode='diff') %>) + <%- end -%>