[openstreetmap/openstreetmap-website] Show tag changes in object history view (PR #6448)
Pablo Brasero
notifications at github.com
Mon Mar 2 11:28:28 UTC 2026
@pablobm commented on this pull request.
> @@ -0,0 +1,131 @@
+# frozen_string_literal: true
+
+module BrowseTagChangesHelper
+ include BrowseTagsHelper
+
+ 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] }
+
+ previous_tags = previous_version&.tags || {}
+
+ tags_added = tags_modified = tags_unmodified = tags_removed = tags_with_unknown_versioning = {}
I should have realised this earlier:
```ruby
a = b = {}
a[:foo] = 1
a # => {foo: 1}
b # => {foo: 1}
```
(By the way, this is the same in other languages. I just checked in Python and JS).
Therefore, the assignment needs to be split:
```suggestion
tags_added = {}
tags_modified = {}
tags_unmodified = {}
tags_removed = {}
tags_with_unknown_versioning = {}
```
This doesn't solve the issue that @tomhughes found in a separate comment (incorrect changes assigned to each versions). Still looking into that one.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6448#pullrequestreview-3875596388
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/6448/review/3875596388 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260302/515333f5/attachment.htm>
More information about the rails-dev
mailing list