<p dir="auto">Block deactivation dates that take needs_view-block views into account were derived using updated_at. This was possible because inactive blocks couldn't be edited and their updated_at date wouldn't change. The logic is explained here:</p>
<p dir="auto"><a href="https://github.com/openstreetmap/openstreetmap-website/blob/e0e6c7f1c26fcddff883dad38a6207475150f323/app/helpers/user_blocks_helper.rb#L20-L24">https://github.com/openstreetmap/openstreetmap-website/blob/e0e6c7f1c26fcddff883dad38a6207475150f323/app/helpers/user_blocks_helper.rb#L20-L24</a></p>
<p dir="auto">With editing of inactive blocks enabled deactivation date needs to be saved explicitly. It is defined for blocks that don't have <code class="notranslate">needs_view</code> and will time out even if the user doesn't look at them. Block with <code class="notranslate">needs_view</code> don't have a defined deactivation date. It's going to be set as soon as the user views the block and clears <code class="notranslate">needs_view</code>. Its value is going to be either the block end date if it's in the future or the current date.</p>
<hr>
<p dir="auto">After creating <code class="notranslate">deactivates_at</code> we no longer need <code class="notranslate">needs_view</code>. A block with <code class="notranslate">needs_view</code> is just a block without <code class="notranslate">deactivates_at</code>. But I can't remove <code class="notranslate">needs_view</code> right away because strong_migrations won't let me to drop the column without extra steps.</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/5069'>https://github.com/openstreetmap/openstreetmap-website/pull/5069</a></p>
<h4>Commit Summary</h4>
<ul>
<li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5069/commits/59a848db65d0af5529ef58cee506c2ede759ebeb" class="commit-link">59a848d</a> Add deactivates_at date to user 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/5069/files">7 files</a>)</p>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5069/files#diff-5fb62154bcc2028d8f094225ee59e06e6dc57b853e0d429f7ebab0168f428111">app/controllers/user_blocks_controller.rb</a>
(27)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5069/files#diff-4a98c66cfd9aac927556a0afaba70f5a1ecfdf8d1bcc845584a08c9858e8a48f">app/helpers/user_blocks_helper.rb</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5069/files#diff-87e8b3e2fbf2b8ad40f3ad15d15af53f2cef9deb2134d983dd3565982cfe8249">app/models/user_block.rb</a>
(24)
</li>
<li>
<strong>A</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5069/files#diff-253d79c614f9398327889fa84b50124242d0d50025176412d6bd068d53e39697">db/migrate/20240813070506_add_deactivates_at_to_user_blocks.rb</a>
(5)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5069/files#diff-1dd5a8f580b9615769ddc19a64a98f455d9d20eb149c443f41d9d3c797d39b12">db/structure.sql</a>
(4)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5069/files#diff-9ca0f3412d30fa75d21d710e7d0f07b08a8eeb934543b9db405b8d63619548c1">test/controllers/user_blocks_controller_test.rb</a>
(128)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5069/files#diff-b6c0b1af31522c030e07c403d8ca797f366f31cffac84e321df63bbc0febca13">test/factories/user_blocks.rb</a>
(2)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5069.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/5069.patch</a></li>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5069.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/5069.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/5069">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLNAV2DA3AJNSHUZMJDZRHT4FAVCNFSM6AAAAABMOBVSWOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ3DGMBZGYZTAOA">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLK5ZXC6YSYQE7FHZZLZRHT4FA5CNFSM6AAAAABMOBVSWOWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHJFT656Q.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/5069</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/5069",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5069",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>