[openstreetmap/openstreetmap-website] add a tag diff to /(node|way|relation)/:id/history (PR #6995)

Stillhart notifications at github.com
Sat Apr 11 19:27:21 UTC 2026


### Description
I added a tag diff between change sets to highlight the changes of tags. 

The diff is not expanded by default. I wanted the diff in between the change sets to avoid confusion with the given state at that time. I wanted the diff to be opt-in.
I used the default bootstrap colors which contrasts many other implementations.
I didn't want any strike through text.

Relates to #738 #1253 #4765 

### Screenshots

#### Expanded
<img width="345" height="390" alt="image" src="https://github.com/user-attachments/assets/37899e6d-6b88-4738-a305-127cab62108b" />

#### Without expansion

<img width="347" height="1134" alt="image" src="https://github.com/user-attachments/assets/5e20693d-03cd-4167-b286-b87c1d372cab" />


### How has this been tested?

- I ran the (new) tests
  - `docker compose exec web bundle exec rails test test/system/element_history_test.rb test/helpers/browse_tags_helper_test.rb `
- I tested it manually on my docker instance

### What should be discussed?

1. It won't show a diff across pagination since I didn't want to mess with record loading. This is by design at the moment. Could be added by just giving the record to the partial.
2. Design is ok but somewhat lacking, but is using the existing bootstrap design.
3. I tried to be screen reader friendly since colors are not obvious, but I'm not certain about that.
4. I don't like the text `Tag changes from version #1 to #2` all that much.
5. Additions green, removals red, but modifications could also be two shades of blue. Or two other shades of green and red.
6. Naming of the two change sets might need improvement inside the code:
   - `old` `new`
   - `previous` `next`
   - `before` `after`

None of the above seem to be deal breakers for me. 

Note: I was AI assisted.
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/6995

-- Commit Summary --

  * add a tag diff to the /history endpoint

-- File Changes --

    A app/helpers/tag_diff_helper.rb (18)
    A app/views/browse/_tag_diff.html.erb (37)
    M app/views/old_elements/index.html.erb (6)
    M config/locales/en.yml (9)
    A test/helpers/tag_diff_helper_test.rb (29)
    M test/system/element_history_test.rb (46)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/6995.patchhttps://github.com/openstreetmap/openstreetmap-website/pull/6995.diff
-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6995
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6995 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260411/0371f567/attachment.htm>


More information about the rails-dev mailing list