<p dir="auto">If you edit an inactive block, you can change its text but you can't reactivate it. You are prevented from reactivating it by keeping the block duration at 0. But even setting the duration to 0 changes the block end time, because it's set to now + duration. This in turn affects the duration as reported on the block show page, that shows duration = end_at - created_at. You wanted to just update the text, yet you altered the duration too. That's not something you expect to happen.</p>
<p dir="auto">This PR keeps old ends_at time when updating inactive blocks.</p>
<p dir="auto">Example with 0-hour block edited months later:</p>
<p dir="auto">Before:<br>
<a href="https://github.com/user-attachments/assets/0a094d09-6e3a-4e21-9a08-9590a7f6d1ee">image.png (view on web)</a></p>
<p dir="auto">After:<br>
<a href="https://github.com/user-attachments/assets/0c579a2f-ec8b-4af3-abea-2557c22efe96">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/5089'>https://github.com/openstreetmap/openstreetmap-website/pull/5089</a></p>
<h4>Commit Summary</h4>
<ul>
<li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5089/commits/cfaae9eadd794d646950421c8d21a6fe356e727f" class="commit-link">cfaae9e</a> Don't update ends_at when editing inactive blocks</li>
</ul>
<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5089/files">2 files</a>)</p>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5089/files#diff-5fb62154bcc2028d8f094225ee59e06e6dc57b853e0d429f7ebab0168f428111">app/controllers/user_blocks_controller.rb</a>
(11)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5089/files#diff-9ca0f3412d30fa75d21d710e7d0f07b08a8eeb934543b9db405b8d63619548c1">test/controllers/user_blocks_controller_test.rb</a>
(6)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5089.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/5089.patch</a></li>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5089.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/5089.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/5089">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLJJUG4ADUITADSEQCDZR4OTHAVCNFSM6AAAAABMVJKB7WVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ3TCNBWGI2DKMY">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLMC5CLCCLKPFMQA6ATZR4OTHA5CNFSM6AAAAABMVJKB7WWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHJGT4GGU.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/5089</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/5089",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5089",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>