[openstreetmap/openstreetmap-website] Show tag changes in object history view (PR #6448)

Pablo Brasero notifications at github.com
Mon Mar 2 11:46:00 UTC 2026


@pablobm commented on this pull request.



> +  def wrap_tags_with_version_changes(tags_to_values, _current_version = nil, all_versions = [])
+    # Find the previous usable version by looking backwards from the end
+    previous_version = all_versions
+                       .reverse
+                       .drop(1)
+                       .find { |v| !v.redacted? || params[:show_redactions] }

I think the problem is here. We never use `_current_version`, so we always get the same version as `previous_version`. All comparisons are to... is it the second to latest version? Whichever.

I think this is the correct code. Note that I have renamed `_current_version` as `current_version` as we are now using it:

```suggestion
  def wrap_tags_with_version_changes(tags_to_values, current_version = nil, all_versions = [])
    # Find the previous usable version by looking backwards from the end
    usable_versions_in_order =
      all_versions
      .reverse
      .filter { |v| !v.redacted? || params[:show_redactions] }

    current_version_index = usable_versions_in_order.find_index { |v| v.version == current_version }
    previous_version = usable_versions_in_order[current_version_index + 1]
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6448#pullrequestreview-3875688370
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6448/review/3875688370 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260302/db72c32f/attachment-0001.htm>


More information about the rails-dev mailing list