Page 1 of 1

Preventing double posts - maybe via jQuery?

Posted: Sun Apr 29, 2018 5:48 pm
by digitaltoast
For some reason, a few users are reporting that they are getting double posts/replies.

I've been able to replicate at least the posting part, by double clicking "submit" on a new post. I'm surprised "prevent 5 posts being made in the same 2 seconds" isn't baked in to phpbb, but nonetheless, this should be quite a simple question of applying a "prevent click" type of method in jquery to the buttons once clicked, should it not?

How have others overcome this? I saw a couple of mods/extensions for this, but they were years old.

Re: Preventing double posts - maybe via jQuery?

Posted: Sun Apr 29, 2018 6:02 pm
by david63
ACP > Post settings > Flood interval

Re: Preventing double posts - maybe via jQuery?

Posted: Sun Apr 29, 2018 6:21 pm
by digitaltoast
Thank you - wasn't aware of that, however, I looked and it's already set to 15 seconds. Hmmmm... :?

Re: Preventing double posts - maybe via jQuery?

Posted: Sun Apr 29, 2018 8:35 pm
by jan_2017
I do not want to advertise, but I use the extension "post merging".
Try it.

Re: Preventing double posts - maybe via jQuery?

Posted: Sun Apr 29, 2018 8:35 pm
by david63
digitaltoast wrote:
Sun Apr 29, 2018 6:21 pm
Thank you - wasn't aware of that, however, I looked and it's already set to 15 seconds. Hmmmm... :?
Then increase it to, say, 30 seconds and see if that solves the problem

Re: Preventing double posts - maybe via jQuery?

Posted: Mon Apr 30, 2018 7:28 am
by digitaltoast
Oh, you mean in case the flag had got corrupted in the DB? Tried it, but still getting two posts.

I mean, we're talking about a flag set for 15 (now 30) seconds, and a double-click speed of between 80 and 100ms.

My server seems to respond to a posting within 300ms, therefore, I wonder if there's some kind of queue/race condition whereby it is not able to check the DB for previous posts as fast as the second post arrives? Which is why I think something "front end" might be better.

Or, as a last resort, possibly there might be something in nginx to prevent rapid fire "post" submissions. But it would be good to fix this natively if at all possible :)

Re: Preventing double posts - maybe via jQuery?

Posted: Mon Apr 30, 2018 7:40 am
by Mick
Sometimes I get that here and other boards and it always seems to be down to server lag, you click submit, it doesn’t appear to go straight away you click again and you end up with double posts.

Re: Preventing double posts - maybe via jQuery?

Posted: Mon Apr 30, 2018 7:44 am
by digitaltoast
I think a server response of 300ms for a post is reasonable - but more to the point, if "flood control" is set to 15 seconds, should that prevent a second post within 100ms?

Re: Preventing double posts - maybe via jQuery?

Posted: Mon Apr 30, 2018 7:48 am
by Mick
I suppose it depends if phpBB has registered that the first post has actually gone at the time submit is clicked a second time.

Re: Preventing double posts - maybe via jQuery?

Posted: Mon Apr 30, 2018 7:52 am
by digitaltoast
Exactly - and I don't think it is. Looks like flood control can't be relied on then; I'll look into jQuery or nginx tweaking and post back here when I've found something that works. Thanks.