<p dir="auto">Here's a problem* that I came across when trying to create a controller for diary comments.</p>
<p dir="auto">You write a comment for a diary entry, submit it and it fails the validation. Currently it's difficult to fail the validation, because empty comments are prevented client-side and it's difficult to type special characters that are disallowed. But let's suppose the validation failed. We have a branch for it:</p>
<p dir="auto"><a href="https://github.com/openstreetmap/openstreetmap-website/blob/50df5eefcc5c45a47e1fcac50fe3ad6af6245819/app/controllers/diary_entries_controller.rb#L154">https://github.com/openstreetmap/openstreetmap-website/blob/50df5eefcc5c45a47e1fcac50fe3ad6af6245819/app/controllers/diary_entries_controller.rb#L154</a></p>
<p dir="auto">It just renders the diary entry page again. You'll be looking at the top of the page, not where the comment form is. And the entered comment is reset:</p>
<p dir="auto"><a href="https://github.com/openstreetmap/openstreetmap-website/blob/50df5eefcc5c45a47e1fcac50fe3ad6af6245819/app/views/diary_entries/show.html.erb#L37">https://github.com/openstreetmap/openstreetmap-website/blob/50df5eefcc5c45a47e1fcac50fe3ad6af6245819/app/views/diary_entries/show.html.erb#L37</a></p>
<p dir="auto">Here I'm showing a different page instead. It has a comment form that keeps the previously entered comment.</p>
<hr>
<p dir="auto">* The actual problem was that with a diary comments controller I'd have to render the show action of another 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/4634'>https://github.com/openstreetmap/openstreetmap-website/pull/4634</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/4634/commits/42c77b3020e0690d51c149a7cb9577cb7fa335d5" class="commit-link">42c77b3</a>  Add a template for failed new diary comment validation</li>
</ul>

<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/4634/files">5 files</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4634/files#diff-4b73866ef57c70fca07c0f330d7a57aae939b11e4aae0514f303df3aa3762f89">app/controllers/diary_entries_controller.rb</a>
    (2)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4634/files#diff-9ebaad32f6bf43b09e4e2c0bfb30d2de8675eeecdaad19cd22cad4d01ac90445">app/views/diary_entries/newcomment.html.erb</a>
    (12)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4634/files#diff-44438ce218f5287c58d0017f965d888715635d94280669896f75841fbd7b4cd7">config/locales/en.yml</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4634/files#diff-959bc9abc46a55332bb64d5155a79323afa75a50ec1a2137ddd22d926f62c6c5">config/routes.rb</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4634/files#diff-10a5c4533814c8b1222f0ef0833c82edd68584d85757fc431557b39813777c19">test/controllers/diary_entries_controller_test.rb</a>
    (4)
  </li>
</ul>

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