Announcement

#1 2018-09-08 15:17:02

vuk
Member
2018-09-05
8

Problem with comments

Hello,

When page is refreshed by F5 pressing just after comment is posted, i get duplicate comments after each refresh. Is any way to avoid this?

Thanks.

Offline

 

#2 2018-09-08 17:37:40

erAck
Only trying to help
2015-09-06
2029

Re: Problem with comments

If a browser refreshes a page that is the immediate result of a POST action (such as posting a comment, updating data, ...) it resends the post action and data. That's just how thing s work and nothing Piwigo specific. Browsers should warn though that they resend the data when refreshing the page, which for example Firefox does. At least when pressing Ctrl+R for refresh, not sure if there's a difference to F5 which I ~never use or if the warning could be disabled.


Running Piwigo at https://erack.net/gallery/

Offline

 

#3 2018-09-08 18:28:40

vuk
Member
2018-09-05
8

Re: Problem with comments

That's just how thing s work and nothing Piwigo specific.

Yes, things works this way, i know it. But, for example, if you look at any forum script you will not find such behavior. Why? Maybe answer is here: https://en.wikipedia.org/wiki/Post/Redirect/Get?

Offline

 

#4 2018-09-09 21:43:28

flop25
Piwigo Team
2006-07-06
7037

Re: Problem with comments

no that exist elsewhere too ; and that's not a bug but a feature. It's a lifesaver when posting a long comment and having a network issue.
for instance on that forum you can't, because it not the same page ; it calls the Add your comment page, then it displays the thread.


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#5 2018-09-09 23:06:04

vuk
Member
2018-09-05
8

Re: Problem with comments

flop25 wrote:

for instance on that forum you can't, because it not the same page ; it calls the Add your comment page, then it displays the thread.

vBulletin forum software (and many others too) for example can add comment not opening new pages. And all works fine.

Let's look at two scenarios.
Forum software:
1. i write a comment
2. i press "Submit" button
3. i get a page with my new comment added
4. i press "refresh" in browser - all works fine, no warnings or duplicate submission occured.

I can call this behavior normal and predictable.

Piwigo:
1. i write a comment
2. i press "Submit" button
3. i get a page with my new comment added
4. i press "refresh" in browser and get a warning about duplicate form submit. To refresh a page normally i must close a page in browser and open it once more or go to address line and press Enter.

Moreover, browsers can behave differently. On Android i get warning in Chrome but not in Opera - pressing Refresh button does nothing here. Opera on desktop computer does not show any warning at all and just makes a duplicate submit.

And another one surprise. When i edit comment in Piwigo and press a submit button, comment is edited, page reloaded and after that pressing Refresh button does not trying to submit form again.

Looking at this I assume that "edit comment" action does redirect but "add comment" action does not.

I can not call this behavior normal and predictable.

P.S. Sorry for my English. Most part of this post was written with a little help from google. :)

Last edited by vuk (2018-09-09 23:08:29)

Offline

 

#6 2018-09-10 19:17:01

flop25
Piwigo Team
2006-07-06
7037

Re: Problem with comments

you are probably too young to understand that's a feature and not a bug
The behavior of Opera IS a bug, since it's sending back the information without asking you (it did once and it has a checkbox Don't remind me)


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#7 2018-09-10 19:53:21

vuk
Member
2018-09-05
8

Re: Problem with comments

flop25 wrote:

you are probably too young to understand that's a feature and not a bug
The behavior of Opera IS a bug, since it's sending back the information without asking you (it did once and it has a checkbox Don't remind me)

Oh, great sensei, let me bow down to your great life experience. :) But let's throw out talks about my age and opera bugs and talk about completely different piwigo behavior in two situations - creating and editing comments. Which of these behaviors is a bug and why?

Offline

 

#8 2018-09-10 20:02:06

flop25
Piwigo Team
2006-07-06
7037

Re: Problem with comments

young Palawan you still don't see the difference but sure I can show you the path from the top of that tree I'm sitting cross-legged 

open
picture.php?/12090/category/155
adding a comment and validating
picture.php?/12090/category/155

open
picture.php?/12090/category/155
click edit
picture.php?/12090/category/155&action=edit_comment&comment_to_edit=342#edit_comment
changing and validating
picture.php?/12090/category/155


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#9 2018-09-10 21:09:26

vuk
Member
2018-09-05
8

Re: Problem with comments

Yes, from the point of view of the IT specialist, I understand you. But let's put ourselves to the user place who does not even look at what's in the address line and does not bother about all these details about addresses and forms and just tries to use the site. User will discover completely different behavior in two similar situations, and, in the case of adding a comment, the behavior will differ from what he used to, using the majority of sites on the Internet.

And one more thing. I tried to make redirect just after comment insertion into the database.
file: include/picture_comment.inc.php
line: 74
added text: redirect($url_self);

Result is: comment added, pressing Refresh does not submit form again but notification about comment is lost.

And yes, i'm understend, it's a not right place to do that, but i'm just tried and look at the result.

Offline

 

#10 2018-09-14 19:18:53

vuk
Member
2018-09-05
8

Re: Problem with comments

Heh! Tried to integrate Commentics self hosted comment system into piwigo.  I took a bootstrap_darkroom theme and embed Commentics at the place of disqus. It's working!

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact