[openstreetmap/openstreetmap-website] Don't update ends_at when editing inactive blocks (PR #5089)
Anton Khorev
notifications at github.com
Sat Aug 17 10:10:59 UTC 2024
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.
This PR keeps old ends_at time when updating inactive blocks.
Example with 0-hour block edited months later:
Before:

After:

You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/openstreetmap-website/pull/5089
-- Commit Summary --
* Don't update ends_at when editing inactive blocks
-- File Changes --
M app/controllers/user_blocks_controller.rb (11)
M test/controllers/user_blocks_controller_test.rb (6)
-- Patch Links --
https://github.com/openstreetmap/openstreetmap-website/pull/5089.patch
https://github.com/openstreetmap/openstreetmap-website/pull/5089.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5089
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5089 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240817/7d7f546d/attachment.htm>
More information about the rails-dev
mailing list