<p></p>
<p><b>@tomhughes</b> requested changes on this pull request.</p>
<p dir="auto">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.</p>
<p dir="auto">The first two PRs should be one to create new methods on <code class="notranslate">Note</code> that correspond to the new fields but just look (for now) at the first comment, and one to add the new fields to <code class="notranslate">Note</code>.</p>
<p dir="auto">After that a PR to validate the new key and one to adjust the new methods in <code class="notranslate">Note</code> to take the description from the note if the first comment has been migrated.</p>
<p dir="auto">Only after that can we have a PR to actually do the migration.</p><hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5485#discussion_r1912484985">app/views/api/notes/_note.json.jbuilder</a>:</p>
<pre style='color:#555'>> @@ -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
</pre>
<p dir="auto">The plan in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1482565414" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/3831" data-hovercard-type="issue" data-hovercard-url="/openstreetmap/openstreetmap-website/issues/3831/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/issues/3831">#3831</a> was to add methods like <code class="notranslate">description</code> to the <code class="notranslate">Note</code> 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.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5485#pullrequestreview-2545467592">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLMMEPUGJK54JIMUMZT2KKIVDAVCNFSM6AAAAABU2OLO2WVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDKNBVGQ3DONJZGI">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLLJX5RJ27FNOTOIFE32KKIVDA5CNFSM6AAAAABU2OLO2WWGG33NNVSW45C7OR4XAZNRKB2WY3CSMVYXKZLTORJGK5TJMV32UY3PNVWWK3TUL5UWJTUXXDAMQ.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/5485/review/2545467592</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/5485#pullrequestreview-2545467592",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5485#pullrequestreview-2545467592",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>