@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/2545467...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to