Battle-hardening

Fix some bugs in the new redirect/change-name implementation.
Not completely bullet-proof, yet (need to deal with
Jason's issue), but getting there.
This commit is contained in:
Jacques Distler 2009-06-05 17:45:57 -05:00
parent a2b1c7e66c
commit 07da370d41
2 changed files with 5 additions and 2 deletions

View file

@ -55,7 +55,8 @@ class WikiReference < ActiveRecord::Base
def self.pages_redirected_to(web, page_name) def self.pages_redirected_to(web, page_name)
names = [] names = []
page = web.page(page_name) page = web.page(page_name)
Thread.current[:page_redirects][page.name].each { |name| names = names + self.pages_that_reference(web, name) } redirected_pages = Thread.current[:page_redirects][page.name]
redirected_pages.each { |name| names = names + self.pages_that_reference(web, name) } if redirected_pages
names.uniq names.uniq
end end

View file

@ -1,5 +1,5 @@
<%- <%-
@title = "Editing #{CGI.escapeHTML(@page.name)}" @title = "Editing #{@page.name.escapeHTML}"
@content_width = 720 @content_width = 720
@hide_navigation = true @hide_navigation = true
-%> -%>
@ -41,6 +41,7 @@
<%- end -%> <%- end -%>
<script type="text/javascript"> <script type="text/javascript">
<!--//--><![CDATA[//><!--
function toggleVisibility() { function toggleVisibility() {
var span = document.getElementById('title_change'); var span = document.getElementById('title_change');
if (span.style.display =='inline') { if (span.style.display =='inline') {
@ -67,4 +68,5 @@ function cleanAuthorName() {
} }
document.forms["editForm"].elements["content"].focus(); document.forms["editForm"].elements["content"].focus();
//--><!]]>
</script> </script>