Skip to content

Commit

Permalink
Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki
Browse files Browse the repository at this point in the history
  • Loading branch information
distler committed May 29, 2022
2 parents 94bcfab + 90efa50 commit a23c7e2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions app/controllers/wiki_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ def revision
else
get_page_and_revision
@show_diff = (params[:mode] == 'diff')
if @nonexistent_revision
flash[:error] = "Redirected from nonexistent revision #{params['rev']}.".html_safe
redirect_to :web => @web_name, :action => 'revision', :id => @page_name, :mode => params[:mode], :rev => @revision_number
end
@renderer = PageRenderer.new(@revision)
end
end
Expand Down Expand Up @@ -559,6 +563,7 @@ def get_page_and_revision
if rev && rev > 0 && rev <= prs
@revision_number = rev
else
@nonexistent_revision = true
@revision_number = prs
end
@revision = @page.revisions[@revision_number - 1]
Expand Down
3 changes: 3 additions & 0 deletions public/s5/ui/core/math.css
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,6 @@ span.theorem_label {font-style:normal; font-weight:bold;}
font-weight: bold;
}
.maruku_toc ul { list-style: none; }
.scaled50 {transform: scale(.5) translate(0%,-50%);}
.scaled625 {transform: scale(.625) translate(0%,-35%);}
.scaled75 {transform: scale(.75) translate(0%,-33%);}
12 changes: 10 additions & 2 deletions test/functional/wiki_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,14 @@ def test_revision
assert_equal @home.revisions[0], r.template_objects['revision']
end

def test_nonexistent_revision
r = process 'revision', 'web' => 'wiki1', 'id' => 'HomePage', 'rev' => '100'

assert_response(302)
assert_redirected_to :web => 'wiki1', :controller => 'wiki', :action => 'revision', :id => 'HomePage', :rev => '2'
assert r.flash[:error].to_s =~ /Redirected from nonexistent revision 100/
end

def test_rollback
# rollback shows a form where a revision can be edited.
# its assigns the same as or revision
Expand Down Expand Up @@ -808,8 +816,8 @@ def test_dnsbl_filter_deny_action

assert_equal 403, r.response_code
resp = [ %{<p>Access denied. Your IP address, 127.0.0.2, was found on one or more DNSBL blocking list(s).</p>\n},
%{<p>See <a href='http://www.spamcop.net/w3m?action=checkblock&amp;ip=127.0.0.2'>here</a> for more information.</p>\n},
%{<p>See <a href='http://www.spamhaus.org/query/bl?ip=127.0.0.2'>here</a> for more information.</p>\n}]
%{<p>See <a href='https://www.spamcop.net/w3m?action=checkblock&amp;ip=127.0.0.2'>here</a> for more information.</p>\n},
%{<p>See <a href='https://www.spamhaus.org/query/bl?ip=127.0.0.2'>here</a> for more information.</p>\n}]
resp.each {|re| assert_match Regexp.new(Regexp.escape(re)), r.body}
assert !File.exist?(File.join(RAILS_ROOT, 'tmp', 'cache', "wiki1_HomePage.cache"))
end
Expand Down

0 comments on commit a23c7e2

Please sign in to comment.