diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-10-21 04:43:15 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-10-21 04:43:15 +0000 |
commit | 9796d18609334eaad05188617217f2405a47a645 (patch) | |
tree | 738c1a31646f87f541e2403455611895b917a2d5 /app/models/wiki_page.rb | |
parent | f09be683232748ba649de6b3c1b62f901d9247b8 (diff) | |
download | redmine-9796d18609334eaad05188617217f2405a47a645.tar.gz redmine-9796d18609334eaad05188617217f2405a47a645.zip |
Handle deleted wiki page versions (#10852).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10684 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/wiki_page.rb')
-rw-r--r-- | app/models/wiki_page.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 2f7803f2a..37d6cf5a4 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -111,11 +111,12 @@ class WikiPage < ActiveRecord::Base def diff(version_to=nil, version_from=nil) version_to = version_to ? version_to.to_i : self.content.version - version_from = version_from ? version_from.to_i : version_to - 1 - version_to, version_from = version_from, version_to unless version_from < version_to - content_to = content.versions.find_by_version(version_to) - content_from = content.versions.find_by_version(version_from) + content_from = version_from ? content.versions.find_by_version(version_from.to_i) : content_to.previous + + if content_from.version > content_to.version + content_to, content_from = content_from, content_to + end (content_to && content_from) ? WikiDiff.new(content_to, content_from) : nil end |