nimforum icon indicating copy to clipboard operation
nimforum copied to clipboard

Post shows edit button but trying to save the message gives "post is too old" error

Open sschwarzer opened this issue 4 years ago • 6 comments

I wrote two posts in the thread https://forum.nim-lang.org/t/8927 and want to edit the second post, https://forum.nim-lang.org/t/8927#58310 . When I edit the post and try to save it I get the error message "This post is too old and can no longer be edited".

I got this message already after a few minutes after posting, and I get it now. But even if the post was too old it wouldn't make sense to show the Edit icon below the post (even when I reload the thread page now). Since posts used to be editable rather for days, I guess the ability to edit is the actually wanted behavior, but it's prevented by the error message instead of a successful submission of the edited post.

My web browser is Firefox 97.0 on Linux.

sschwarzer avatar Feb 20 '22 11:02 sschwarzer

The relevant code is here: https://github.com/nim-lang/nimforum/blame/master/src/forum.nim#L516.

Reading it I don't see what the cause of this could be. @narimiran any ideas?

dom96 avatar Feb 20 '22 11:02 dom96

Thanks for the quick reply! :-)

I don't know if it's relevant for reproducing the bug, but before the mentioned two posts I hadn't posted any message for over a year. Maybe there's a threshold of some kind that's not processed correctly.

sschwarzer avatar Feb 20 '22 11:02 sschwarzer

Reading it I don't see what the cause of this could be. @narimiran any ideas?

I've taken a quick look. I think my change of allowed time for edit didn't introduce this.

I think this code here should be changed to account for the elapsed time since posting and then don't show edit and delete buttons — fix in #316.

narimiran avatar Feb 21 '22 18:02 narimiran

Thanks for the fix!

I still wonder why I couldn't edit the post anymore even after a few minutes. As far as I understand the code, the threshold is supposed to be two hours, isn't it?

sschwarzer avatar Feb 22 '22 10:02 sschwarzer

I still wonder why I couldn't edit the post anymore even after a few minutes. As far as I understand the code, the threshold is supposed to be two hours, isn't it?

This is something I didn't experience in my using of the forum, i.e. I regularly edit my posts after I submit them.

narimiran avatar Feb 22 '22 14:02 narimiran

This is something I didn't experience in my using of the forum, i.e. I regularly edit my posts after I submit them.

I believe you, but I experienced it nonetheless. :-) It seems there are additional conditions for this bug. If you don't want to invest more time in debugging this problem, I understand that, too.

Do you have any plans when to deploy the fix on https://forum.nim-lang.org ? If the new version is there, I'd tell you in case I run again into the "can't edit shortly after posting" issue.

sschwarzer avatar Feb 23 '22 12:02 sschwarzer