From c2688e3aff46770e1c11f703fe218b89a2b71a8c Mon Sep 17 00:00:00 2001 From: evazion Date: Sat, 18 Jan 2020 20:04:23 -0600 Subject: [PATCH] Fix #4263: Wiki page differences use the wrong order. Standardize DiffBuilder to treat the first argument as the new item and the second argument as the old item. This is the order used in most other places. --- app/helpers/pool_versions_helper.rb | 2 +- app/logical/diff_builder.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/pool_versions_helper.rb b/app/helpers/pool_versions_helper.rb index 502000396..4c6fe01e8 100644 --- a/app/helpers/pool_versions_helper.rb +++ b/app/helpers/pool_versions_helper.rb @@ -21,6 +21,6 @@ module PoolVersionsHelper def pool_page_diff(pool_version, other_version) pattern = Regexp.new('(?:<.+?>)|(?:\w+)|(?:[ \t]+)|(?:\r?\n)|(?:.+?)') - DiffBuilder.new(other_version.description, pool_version.description, pattern).build + DiffBuilder.new(pool_version.description, other_version.description, pattern).build end end diff --git a/app/logical/diff_builder.rb b/app/logical/diff_builder.rb index deacc480d..75fe2c30b 100644 --- a/app/logical/diff_builder.rb +++ b/app/logical/diff_builder.rb @@ -12,7 +12,7 @@ class DiffBuilder otharr = that_text.scan(pattern) cbo = Diff::LCS::ContextDiffCallbacks.new - diffs = thisarr.diff(otharr, cbo) + diffs = otharr.diff(thisarr, cbo) escape_html = ->(str) {str.gsub(/&/, '&').gsub(//, '>')}