<p></p>
<p dir="auto">The way that I would approach this refactoring would be roughly:</p>
<ul dir="auto">
<li>Corral all the complexity and special casing into the models, rather than having the logic spread out over controllers and views as we currently have. So if you ask for e.g. <code class="notranslate">@note.comments</code> you would not get the special first comment in the list returned. Other things like <code class="notranslate">current_user.note_comments</code> would also behave as expected, with no special first comments that then need to be ignored.</li>
<li>Rework the controllers and views to act as we would expect for the end stage, e.g. when creating a Note you provide the body and author to <code class="notranslate">Note#create</code> rather than the two-step process currently in api/notes_controller</li>
<li>Create a migration to add the author and body to the Note database tables, start to use them when they are available, and start backfilling them from the special first comments. Destroy the unnecessary special first comments when they are no longer needed.</li>
<li>The output of the API has to remain the same for now, of course. But the special first comments can be synthesised for API 0.6, and dropped in the next API version so that only the genuine comments are shown.</li>
</ul>

<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/issues/3831#issuecomment-1341562044">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLIBINBAB7DDFJNJPQDWMDYLRANCNFSM6AAAAAASXEX644">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLII2WESK4LQ2EGCML3WMDYLRA5CNFSM6AAAAAASXEX646WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSP62OLY.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/issues/3831/1341562044</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/issues/3831#issuecomment-1341562044",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/3831#issuecomment-1341562044",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>