From 95dd28fc5288a937f3085b595b5f8113ed2e519d Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 12 Jan 2020 15:28:07 -0600 Subject: [PATCH] /wiki_page_versions/diff: automatically fix comparison order. Automatically fix it so that we always compare the newer version with the wiki version, regardless of the order the pages are given in. --- app/controllers/wiki_page_versions_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/wiki_page_versions_controller.rb b/app/controllers/wiki_page_versions_controller.rb index 8a7fa7273..8b57fe1e6 100644 --- a/app/controllers/wiki_page_versions_controller.rb +++ b/app/controllers/wiki_page_versions_controller.rb @@ -20,5 +20,11 @@ class WikiPageVersionsController < ApplicationController @thispage = WikiPageVersion.find(params[:thispage]) @otherpage = WikiPageVersion.find(params[:otherpage]) + + if @thispage.id < @otherpage.id + @thispage, @otherpage = @otherpage, @thispage + end + + respond_with([@thispage, @otherpage]) end end