[openstreetmap/openstreetmap-website] Moves the note's description, author ID, and author IP from the first comment to the note itself (PR #5485)
Nenad Vujicic
notifications at github.com
Wed Jan 8 17:45:02 UTC 2025
<!--
Please read the contributing guidelines before making a PR:
https://github.com/openstreetmap/openstreetmap-website/blob/master/CONTRIBUTING.md
Pay particular attention to the section on how to present PRs:
https://github.com/openstreetmap/openstreetmap-website/blob/master/CONTRIBUTING.md#pull-requests
-->
### Description
PR improves using of note's description / author_id / author_ip by:
1. Adding new fields to notes table for storing these 3 values
2. Copying values from first note's comment to notes table
3. Replacing using note's description / author / author_id from first note's comment with from note's table directly
A few comments:
- We left adding description to body when creating new note - it looked dirty to add blank string ("") or similar, also, left comments body intact during data-migration for improving performances,
- We kept backward compatibility of generated XML / JSON / .. by inserting note's description as a first comment's text,
- We added more robust version of data-migration script for retrying migration of failed notes.
### How has this been tested?
By running automated tests and by semi-manual testing (semi-manual generating notes, doing migration and applying changes, manually checking rendered notes and new memory variables content).
You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/openstreetmap-website/pull/5485
-- Commit Summary --
* Added description, user_id and user_ip to notes
* Improved note's creation to use Note.description
* Improved note's displaying to use Note attributes
* Updated j(builder) files to use Note.description
* Updated tests to work with the latest changes
* Enhance backfill migration script with logging, retries, and conversion fixes
-- File Changes --
M app/controllers/api/notes_controller.rb (35)
M app/models/note.rb (37)
M app/views/api/notes/_comment.html.erb (10)
M app/views/api/notes/_note.json.jbuilder (9)
M app/views/api/notes/_note.xml.builder (9)
M app/views/notes/show.html.erb (2)
A db/migrate/20250104140952_add_description_to_notes.rb (9)
A db/migrate/20250105154621_validate_foreign_key_on_notes.rb (5)
A db/migrate/20250106160355_backfill_note_descriptions.rb (169)
M db/structure.sql (16)
M test/controllers/api/notes_controller_test.rb (12)
M test/factories/notes.rb (1)
M test/models/note_test.rb (16)
M test/system/index_test.rb (8)
M test/system/report_note_test.rb (4)
M test/system/report_user_test.rb (4)
-- Patch Links --
https://github.com/openstreetmap/openstreetmap-website/pull/5485.patch
https://github.com/openstreetmap/openstreetmap-website/pull/5485.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5485
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5485 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250108/fee7e82c/attachment.htm>
More information about the rails-dev
mailing list