<p dir="auto">Previously there were <code class="notranslate">hide</code> and <code class="notranslate">unhide</code> actions on changeset comments and an attempt to change them into standard actions which didn't quite work. It went like this: hiding a comment is like deleting, let's map <code class="notranslate">hide</code> path to <code class="notranslate">destroy</code> action; unhiding is like... there's no standard undelete/undestroy, let's invent another nonstandard <code class="notranslate">restore</code> name for now. <code class="notranslate">create</code> couldn't be used as an opposite action because it creates a new comment.</p>
<p dir="auto">However <code class="notranslate">destroy</code> and <code class="notranslate">create</code> could be used if another resource is introduced. That's what this PR does. Since these operations change <code class="notranslate">visible</code> attributes, I guess the resource name should be <code class="notranslate">visibility</code>. Then we'll have something similar to message <code class="notranslate">read_mark</code> from <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2805680878" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/5536" data-hovercard-type="pull_request" data-hovercard-url="/openstreetmap/openstreetmap-website/pull/5536/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/pull/5536">#5536</a> that can be created and deleted and also changes an attribute.</p>
<p dir="auto">That requires a different path. Since the collection path was already introduced in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2004719320" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/4359" data-hovercard-type="pull_request" data-hovercard-url="/openstreetmap/openstreetmap-website/pull/4359/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/pull/4359">#4359</a> as <code class="notranslate">/api/0.6/changeset_comments</code>, the visibility resource path should be<code class="notranslate">/api/0.6/changeset_comments/:id/visibility</code>. <code class="notranslate">DELETE</code>/<code class="notranslate">POST</code> at this path hide/unhide the comment. For backwards compatibility <code class="notranslate">POST /api/0.6/changeset/comment/:id/hide</code> is mapped to <code class="notranslate">destroy</code> and <code class="notranslate">POST /api/0.6/changeset/comment/:id/unhide</code> is mapped to <code class="notranslate">create</code> actions on visibility.</p>
<p dir="auto">This removes all nonstandard actions from changeset comments controller.</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/5726'>https://github.com/openstreetmap/openstreetmap-website/pull/5726</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/commits/457cc99349972c4cfc52959aac317562c99e47d1" class="commit-link">457cc99</a>  Test response body of changeset comment hide/unhide</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/commits/84a0c76ab2a09a05e10b9057c9087a342db5f7e2" class="commit-link">84a0c76</a>  Create api changeset comment visibility resource</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/commits/c88770e4ce2e0d00606e77fa93deba9977bf6a5e" class="commit-link">c88770e</a>  Refactor api changeset comment visibility xml tests</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/commits/3765a7e89e905c0f8b24c44b426b19db11a0f034" class="commit-link">3765a7e</a>  Refactor api changeset comment visibility json tests</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/commits/075f8df94afd8ad7b8d4ee684d844e25da5349c2" class="commit-link">075f8df</a>  Test api changeset comment hide/unhide at legacy routes</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/commits/0d72d0ca496785177700cbea4b39a0bbd03c76ed" class="commit-link">0d72d0c</a>  Remove unnecessary RuboCop exclusion</li>
</ul>

<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/files">14 files</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/files#diff-4f894049af3375c2bd4e608f546f8d4a0eed95464efcdea850993200db9fef5c">.rubocop.yml</a>
    (1)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/files#diff-341a1cf4f83cf00816b397c262181cd7b229f1c0e9210ba57dcef3f9609c1b74">app/abilities/api_ability.rb</a>
    (2)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/files#diff-2400ff594fdba2ab8bbb8fc9ffe5203fc88d4806a70a7c26ebe786cf88ebcf0d">app/controllers/api/changeset_comments/visibilities_controller.rb</a>
    (60)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/files#diff-cbcb9ae851f89928d6366b8fbce29b38d3fb6dcc2c7ae61fdf7f3bb40911b976">app/controllers/api/changeset_comments_controller.rb</a>
    (50)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/files#diff-6726f8601cd22886963fb41888b55956cae4f8124aa12c701da77c3add44d94c">app/controllers/api/changesets_controller.rb</a>
    (2)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/files#diff-422d2b222b1eae82de0af9c7cee81ef6ded441a06fe3d9b39b88cacdfe6fb3d8">app/views/api/changeset_comments/visibilities/create.json.jbuilder</a>
    (5)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/files#diff-d77186343df8a4832c6c7c2dfdc7760bb8941ed3e217a136311d0ce3213ff1d7">app/views/api/changeset_comments/visibilities/create.xml.builder</a>
    (5)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/files#diff-e11411287b09fe5dbc31a695c17b451440895b7905fce32d5697e2b02cb6a9c0">app/views/api/changeset_comments/visibilities/destroy.json.jbuilder</a>
    (5)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/files#diff-0aeb865912c720b602f3c940a283b3a831b5eb0435aba0188e5be1105fc372e5">app/views/api/changeset_comments/visibilities/destroy.xml.builder</a>
    (5)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/files#diff-9a5f2cb48e3a30fd0197d016bd900f26d7183d6714f3a747613c9cbe4a9c8f9d">app/views/changesets/show.html.erb</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/files#diff-959bc9abc46a55332bb64d5155a79323afa75a50ec1a2137ddd22d926f62c6c5">config/routes.rb</a>
    (8)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/files#diff-86f561066896ab4c4f2fd512c55cc748080ab2e25de3690f85799488afab194f">test/abilities/api_capability_test.rb</a>
    (28)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/files#diff-8083fc0489471a1b4563c74a4e56ae4507206ce14c75ced78f1b79401e52b316">test/controllers/api/changeset_comments/visibilities_controller_test.rb</a>
    (253)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5726/files#diff-d9b2ae2e2b75786d4664345e608b1dd8e34b7854f4714bdec7afeb29b3710159">test/controllers/api/changeset_comments_controller_test.rb</a>
    (130)
  </li>
</ul>

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