[openstreetmap/openstreetmap-website] Moves the note's description, author ID, and author IP from the first comment to the note itself (PR #5485)
Tom Hughes
notifications at github.com
Sun Jan 12 16:18:25 UTC 2025
@tomhughes requested changes on this pull request.
This is going to need to be broken down in to multiple PRs as we can't take all three migrations in one go, and we can't take code changes that rely on new fields until after those fields have been created.
The first two PRs should be one to create new methods on `Note` that correspond to the new fields but just look (for now) at the first comment, and one to add the new fields to `Note`.
After that a PR to validate the new key and one to adjust the new methods in `Note` to take the description from the note if the first comment has been migrated.
Only after that can we have a PR to actually do the migration.
> @@ -32,8 +32,13 @@ json.properties do
json.action comment.event
if comment.body
- json.text comment.body.to_text
- json.html comment.body.to_html
+ if comment.event == "opened"
+ json.text note.description.to_text
+ json.html note.description.to_html
+ else
+ json.text comment.body.to_text
+ json.html comment.body.to_html
+ end
The plan in #3831 was to add methods like `description` to the `Note` model first so that we can hide this kind of logic in one place and avoid duplicating it even temporarily - those methods can then be removed once the migration is complete.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5485#pullrequestreview-2545467592
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5485/review/2545467592 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250112/ba535603/attachment-0001.htm>
More information about the rails-dev
mailing list