[openstreetmap/openstreetmap-website] Expired blocks do not show for how long they were crafted (#3143)

Andy Allan notifications at github.com
Wed Apr 28 14:53:04 UTC 2021


> (BTW, codewise, isn't the variable `updated_at` is a bit of a misnomer? It appears to be unrelated to the `update` function of a block, which appears to influence the `ends_at` time. Thus easier to understand would be `read_at`)

I've been looking at this today, and I think there's a few oddities with the user blocks. For example, the `updated_at` is indeed a rails thing, so as well as updating the model when it is viewed by the recipient, it's also updated if the block is ever edited e.g. by a moderator editing the block_reason at any point. So I think it's unwise to rely on that, and I think we should move to having a `viewed_at` or `acknowledged_at`, and only update that when it's the user viewing it, rather than (potentially) side effects of other things. At the moment it (just about) works, since moderators can't edit the block after it has finished, and the `show` method implicitly relies on rails' "dirty" handling to avoid updating it each time it's viewed - but still :frowning_face: 





-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/3143#issuecomment-828521259
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20210428/83b34cec/attachment.htm>


More information about the rails-dev mailing list