/wiki_page_versions/diff: use SetDiff to diff other_names.

Use SetDiff instead of DiffBuilder to generate diffs for wiki page other
names. SetDiff is what we use for artist other names.
This commit is contained in:
evazion
2020-01-12 15:32:34 -06:00
parent 95dd28fc52
commit 90b94adee8
6 changed files with 24 additions and 18 deletions

View File

@@ -1,21 +1,21 @@
<%# diff %>
<%# diff, ul_class, li_class %>
<ul class="diff-list">
<%= tag.ul class: [*ul_class] do %>
<% diff.added.each do |item| %>
<%= tag.li item, class: (item.in?(diff.obsolete_added) ? "obsolete added" : "added") %>
<%= tag.li item, class: ["added", ("obsolete" if item.in?(diff.obsolete_added)), *li_class] %>
<% end %>
<% diff.removed.each do |item| %>
<%= tag.li item, class: (item.in?(diff.obsolete_removed) ? "obsolete removed" : "removed") %>
<%= tag.li item, class: ["removed", ("obsolete" if item.in?(diff.obsolete_removed)), *li_class] %>
<% end %>
<% diff.changed.each do |old, new| %>
<%= tag.li class: "changed" do %>
<%= tag.span old, class: "removed" %>→ <%= tag.span new, class: "added" %>
<%= tag.span old, class: ["removed", *li_class] %>→ <%= tag.span new, class: ["added", *li_class] %>
<% end %>
<% end %>
<% diff.unchanged.each do |item| %>
<%= tag.li item, class: "unchanged" %>
<%= tag.li item, class: ["unchanged", *li_class] %>
<% end %>
</ul>
<% end %>

View File

@@ -6,9 +6,8 @@
<% if @thispage.visible? %>
<p>Showing differences between <%= compact_time @thispage.updated_at %> (<%= link_to_user @thispage.updater %>) and <%= compact_time @otherpage.updated_at %> (<%= link_to_user @otherpage.updater %>)</p>
<div>
<%= wiki_other_names_diff(@thispage, @otherpage) %>
</div>
<%= wiki_other_names_diff(@thispage, @otherpage) %>
<div>
<%= wiki_body_diff(@thispage, @otherpage) %>
</div>