<h3 dir="auto">Description</h3>
<p dir="auto">PR proposes adding support for note versions and variable note tags. Here is a detailed list of changes:</p>
<ol dir="auto">
<li>Updated and created database tables <code class="notranslate">notes</code> and <code class="notranslate">note_versions</code> for keeping note versions like it is done for other elements (nodes, ways and relations)</li>
<li>Added creating new version whenever note is reopened / closed / hidden and improved creating / saving notes by using same methods (from_<em>, save_</em> methods) like it is done for other elements (nodes, ways, relations). Also, ID of generated note-comment is kept in <code class="notranslate">note_versions</code> for easier reconstructing note's provenance.</li>
<li>Added generating new versions from note comments (for every reopening, closing, hiding new note version is generated and ID of appropriate note-comment is kept for easier reconstructing note's provenance)</li>
<li>Created database tables <code class="notranslate">note_tags</code> and <code class="notranslate">note_tag_versions</code> for keeping versioned note tags</li>
<li>Added support for creating and saving versioned note tags (from URL encoded parameters)</li>
<li>Added support for updating notes properties (description, latitude, longitude and tags). To update a note, one should send PUT HTTP request with <strong>FULL</strong> note definition from which new note version content will be reconstructed (similarly when creating)</li>
<li>Added basic testing of above functionalities</li>
</ol>
<p dir="auto">I have already opened <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5815" data-hovercard-type="pull_request" data-hovercard-url="/openstreetmap/openstreetmap-website/pull/5815/hovercard">first PR</a> which does the first step, but wanted to show how it can look like at the end and would like to read your comments about it.</p>
<p dir="auto">Please, let me know what you think about this.</p>
<p dir="auto">Thanks.</p>
<h3 dir="auto">How has this been tested?</h3>
<p dir="auto">Automated tests and manual testing by injecting code snippets after creating notes datasets</p>
<h3 dir="auto">Here is how it should look like</h3>
<p dir="auto">Displayed resolved note:<br>
<a href="https://github.com/user-attachments/assets/782fb6de-fd52-4fa1-94fc-369baa29b341">image.png (view on web)</a></p>
<p dir="auto">Displayed opened note:<br>
<a href="https://github.com/user-attachments/assets/92b7bc2e-d35e-41a6-b283-f3f3f0d0582f">image.png (view on web)</a></p>
<p dir="auto">XML output for "opened note":<br>
<a href="https://github.com/user-attachments/assets/696ae767-28be-4e0e-b036-e004d7db8a98">image.png (view on web)</a></p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/openstreetmap/openstreetmap-website/pull/5904'>https://github.com/openstreetmap/openstreetmap-website/pull/5904</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/commits/2c8c75eb0279ed50515a417fa7a3609644832413" class="commit-link">2c8c75e</a>  Adds note versioning and adds note_versions table</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/commits/8bd67fa75601399e0e4795e7b175f1f9fb448a79" class="commit-link">8bd67fa</a>  Adds from_* and save_*! methods to notes</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/commits/a1f1f4d38e76066d9198d14ddf85008131266b27" class="commit-link">a1f1f4d</a>  Adds using from_* and save_*! methods</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/commits/54a776040601938f1c6528e7529ddbe62546c7ee" class="commit-link">54a7760</a>  Adds generating notes versions</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/commits/7f9bfc22cb1dd2d53fdc2d71f1072d3428574e7e" class="commit-link">7f9bfc2</a>  Adds note_tags and note_tag_versions tables</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/commits/de2d0e7ff2fed2bc6b81eefe93a4225aa5053a42" class="commit-link">de2d0e7</a>  Adds support for creating versioned note tags</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/commits/d166c39fffeb5dda5fac5a223cf77bd605ab0fb1" class="commit-link">d166c39</a>  Adds notes updating capability</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/commits/a75d25eb3981ad7b3dc53de55614b108ce583d63" class="commit-link">a75d25e</a>  Adds displaying tags on Notes sidebar</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/commits/0a7ffd6c97993c8e4be4f399fbebef79c12c260e" class="commit-link">0a7ffd6</a>  Updated (j)builder files with note tags</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/commits/fa9bc0ffc6040f389b9a00f53c72f781444ace67" class="commit-link">fa9bc0f</a>  Adds note_tag factory and NoteTag model unit tests</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/commits/493bf6f069b99d3d23cc325348b2428f06565565" class="commit-link">493bf6f</a>  Adds note_version factory and NoteVersion model unit tests</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/commits/ec8b06f3aa40cf0aa224aec2309c29cafd9782f7" class="commit-link">ec8b06f</a>  Adds note_tag_version factory and NoteTagVersion model unit tests</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/commits/e39832d29a379860f082ce068ba82b35c13858f8" class="commit-link">e39832d</a>  Adds tests note/tag output created at ActiveRecord level</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/commits/95235e984c2d91e1e63a356d119b7c197259982f" class="commit-link">95235e9</a>  Adds tests note/tag output created at POST/HTML level</li>
</ul>

<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files">25 files</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-debf59904131dc89a88ab44cbb1d6deaaa5a7d70c0507f674080df62f7c8e41f">app/abilities/ability.rb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-341a1cf4f83cf00816b397c262181cd7b229f1c0e9210ba57dcef3f9609c1b74">app/abilities/api_ability.rb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-08fd2f80528286cf96375b12d81cac98954dee8e6a6899f5f261a127861fdd49">app/assets/javascripts/index/new_note.js</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-6e9fe051c0ef757618e376ffe731dfca8d4960ef0838b7d6a05609b46ba0fad1">app/controllers/api/notes_controller.rb</a>
    (109)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-08ddccf408b18937e98b422e555eaf851c2a02c3ba815c5aeb8bc00efe65ecab">app/models/note.rb</a>
    (103)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-81be17ec98bec3c251b17903545e5895fe358d39325ab06eb5c343a00e7dd56a">app/models/note_tag.rb</a>
    (20)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-a7049548a8b4de6ff511cf01a770a7198a915b01db9c31183036c93305baeac4">app/models/note_tag_version.rb</a>
    (21)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-a67bec099034f48612033fd6a1b9e5f33c0577de0ba55feb56cd8073c36950fb">app/models/note_version.rb</a>
    (69)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-8e70c530a3e7f6eb777b75ec26204721dd896dedf08d20582adb5da76aba544c">app/views/api/notes/_note.gpx.builder</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-a14835243072d71830ba15ff480de24e3146811fabdf73b7e35670af209fbf05">app/views/api/notes/_note.json.jbuilder</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-143dab9bcdf18ed43c02d5c815e4fb922faf69c55a45c4c8af8c7cb07af310e9">app/views/api/notes/_note.xml.builder</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-84d04c9c37a8be927ab1870e6b3c1940f670585b77b8e88c32d6ded35cf87dc7">app/views/notes/show.html.erb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-959bc9abc46a55332bb64d5155a79323afa75a50ec1a2137ddd22d926f62c6c5">config/routes.rb</a>
    (2)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-76953e0308a4fe5a5ff7f514299aa1e63395b5d47121b2cc5e95e95ddf50f732">db/migrate/20250316212229_create_note_versions.rb</a>
    (26)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-49823fdb4829331f136a2e69bc607a29b83fc12e6db6d4fa5d2ced072489cbc5">db/migrate/20250317122723_backfill_note_versions.rb</a>
    (64)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-d598a8c261ec0a7f8d8d6704d5eb6fbaeb8abf1252e67c4d5332c03975ac40d2">db/migrate/20250317162641_create_note_tags_and_note_tag_versions.rb</a>
    (22)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-1dd5a8f580b9615769ddc19a64a98f455d9d20eb149c443f41d9d3c797d39b12">db/structure.sql</a>
    (104)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-b4cc80ae5a4279eef2a7494cb8c489220ce03acaf36932b2042247df9d316908">test/controllers/api/notes_controller_test.rb</a>
    (69)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-b41a560e061b578bbf13158bf175036a9489241ab69f59137c44d57df9682fa7">test/controllers/notes_controller_test.rb</a>
    (21)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-c9dd2e1d433c782dcfe4c5894dae94c8aa6af56e0f5cad574fdecde4cfbd34e1">test/factories/note_tag_versions.rb</a>
    (8)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-9bda23e9b0c9dbd54b3d4f4e846031f867317f30b673a60c72e6a9b06621b960">test/factories/note_tags.rb</a>
    (8)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-c2925d61f4447f8fe19a1c3a1c060bc0b975bb7dfade2c7b306dec0d996838ef">test/factories/note_versions.rb</a>
    (15)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-35e08b22421302c54865eb32008165be551c0c934e972f08cb69f2c1d488eaab">test/models/note_tag_test.rb</a>
    (49)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-7d928799ea43f57aeb202894c8ab0e419af87603155d7fe22708853a7df356d2">test/models/note_tag_version_test.rb</a>
    (49)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5904/files#diff-ed7aa4da517480ff6e9a8aebe9064e6ffe023c742a8bbb55e7a6c53f38aa3641">test/models/note_version_test.rb</a>
    (11)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5904.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/5904.patch</a></li>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5904.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/5904.diff</a></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/pull/5904">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLJGIM3V57N43FOQVVL2YJZMNAVCNFSM6AAAAAB2TRU5CGVHI2DSMVQWIX3LMV43ASLTON2WKOZSHE3TMNZZGM2TONA">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLK2LRVLOWRTZ4PB3LL2YJZMNA5CNFSM6AAAAAB2TRU5CGWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHLC3SD4Y.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/5904</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/5904",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5904",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>