### Description

PR proposes adding support for note versions and variable note tags. Here is a 
detailed list of changes:

1. Updated and created database tables `notes` and `note_versions` for keeping 
note versions like it is done for other elements (nodes, ways and relations)
2. Added creating new version whenever note is reopened / closed / hidden and 
improved creating / saving notes by using same methods (from_*, save_* methods) 
like it is done for other elements (nodes, ways, relations). Also, ID of 
generated note-comment is kept in `note_versions` for easier reconstructing 
note's provenance.
3. Added generating new versions from note comments (for every reopening, 
closing, hiding new note version is generated and ID of appropriate 
note-comment is kept for easier reconstructing note's provenance)
4. Created database tables `note_tags` and `note_tag_versions` for keeping 
versioned note tags
5. Added support for creating and saving versioned note tags (from URL encoded 
parameters)
6. Added support for updating notes properties (description, latitude, 
longitude and tags). To update a note, one should send PUT HTTP request with 
**FULL** note definition from which new note version content will be 
reconstructed (similarly when creating)
7. Added basic testing of above functionalities

I have already opened [first 
PR](https://github.com/openstreetmap/openstreetmap-website/pull/5815) which 
does the first step, but wanted to show how it can look like at the end and 
would like to read your comments about it.

Please, let me know what you think about this.

Thanks.

### How has this been tested?

Automated tests and manual testing by injecting code snippets after creating 
notes datasets

### Here is how it should look like

Displayed resolved note:
![image](https://github.com/user-attachments/assets/782fb6de-fd52-4fa1-94fc-369baa29b341)

Displayed opened note:
![image](https://github.com/user-attachments/assets/92b7bc2e-d35e-41a6-b283-f3f3f0d0582f)

XML output for "opened note":
![image](https://github.com/user-attachments/assets/696ae767-28be-4e0e-b036-e004d7db8a98)
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Adds note versioning and adds note_versions table
  * Adds from_* and save_*! methods to notes
  * Adds using from_* and save_*! methods
  * Adds generating notes versions
  * Adds note_tags and note_tag_versions tables
  * Adds support for creating versioned note tags
  * Adds notes updating capability
  * Adds displaying tags on Notes sidebar
  * Updated (j)builder files with note tags
  * Adds note_tag factory and NoteTag model unit tests
  * Adds note_version factory and NoteVersion model unit tests
  * Adds note_tag_version factory and NoteTagVersion model unit tests
  * Adds tests note/tag output created at ActiveRecord level
  * Adds tests note/tag output created at POST/HTML level

-- File Changes --

    M app/abilities/ability.rb (2)
    M app/abilities/api_ability.rb (2)
    M app/assets/javascripts/index/new_note.js (3)
    M app/controllers/api/notes_controller.rb (109)
    M app/models/note.rb (103)
    A app/models/note_tag.rb (20)
    A app/models/note_tag_version.rb (21)
    A app/models/note_version.rb (69)
    M app/views/api/notes/_note.gpx.builder (4)
    M app/views/api/notes/_note.json.jbuilder (2)
    M app/views/api/notes/_note.xml.builder (4)
    M app/views/notes/show.html.erb (2)
    M config/routes.rb (2)
    A db/migrate/20250316212229_create_note_versions.rb (26)
    A db/migrate/20250317122723_backfill_note_versions.rb (64)
    A db/migrate/20250317162641_create_note_tags_and_note_tag_versions.rb (22)
    M db/structure.sql (104)
    M test/controllers/api/notes_controller_test.rb (69)
    M test/controllers/notes_controller_test.rb (21)
    A test/factories/note_tag_versions.rb (8)
    A test/factories/note_tags.rb (8)
    A test/factories/note_versions.rb (15)
    A test/models/note_tag_test.rb (49)
    A test/models/note_tag_version_test.rb (49)
    A test/models/note_version_test.rb (11)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/5904.patch
https://github.com/openstreetmap/openstreetmap-website/pull/5904.diff

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

Message ID: <openstreetmap/openstreetmap-website/pull/5...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to