[openstreetmap/openstreetmap-website] Show tag changes in object history view (PR #6448)
Pablo Brasero
notifications at github.com
Fri Oct 17 10:46:38 UTC 2025
@pablobm commented on this pull request.
> @@ -72,6 +72,63 @@ def link_follow(object)
"nofollow" if object.tags.empty?
end
+ # Tag change highlighting methods for history view
+ def tag_changes_for_version(current_version, all_versions)
+ return {} unless current_version && all_versions
+
+ current_tags = current_version.tags || {}
+
+ # Find the previous version by sorting all versions and finding the one before current
+ sorted_versions = all_versions.sort_by(&:version)
+ current_index = sorted_versions.find_index { |v| v.version == current_version.version }
+ previous_version = current_index&.positive? ? sorted_versions[current_index - 1] : nil
+
+ # Don't compare with redacted versions unless we're showing redactions
+ previous_tags = if previous_version && (!previous_version.redacted? || params[:show_redactions])
Would it make sense to filter out the redacted versions when finding the index above, and show changes that skip versions?
So for example: if we have v1, v2(redacted), v3, then show changes between v1 and v3
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6448#pullrequestreview-3349444623
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/6448/review/3349444623 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20251017/9dc995e4/attachment.htm>
More information about the rails-dev
mailing list