This has happened to me and site visitors several times now.
Comment module saves what node we are in every time comments are loaded.
If, while composing a comment, I browser other nodes in separate windows or tabs, when I submit the comment, I get redirected to the last node I was browsing, not the one I submitted to.
Looking into how to correct this now, but this behaviour is rather confusing.
It really should probably track node ID in a hidden field when doing a compose/preview/submit sequence, or simply rely on the url itself. That should have the node name, right?

Comments

gábor hojtsy’s picture

Ah, this was that strange behaviour I have seen (and thought that some referer sessioned variable causes it). The problem with hidden fields is that with caching there will be problems... The problem with session variables is that multiple windows screw up. Maybe a different solution could be found? I have no idea yet...

Anonymous’s picture

Storing a session var is OK, but we should be more specific. A global 'referer' is insufficient. We need to also store a 'compose_destination' var as as needed. This should be set only when we arrive at a add/edit page.

kyber’s picture

Actually, neither seems to be necessary to me.
The link is:
comment/reply/NODEID

Why the heck not *use* this information which is there when a submission occurs to do the redirect?

kyber’s picture

To further clarify that comment.
form action="http://www.teahouseslam.org/?q=comment/reply/107"
That's the post link for submitting.
I think the comment refer saving session variable should just be eliminated because drupal does just fine at keeping track of what node you were at on its own.

Anonymous’s picture

I'd like to note, amusingly, that Orkut has this same behaviour.
Presumably for similar reasons.

moshe weitzman’s picture

Assigned: Unassigned » moshe weitzman
StatusFileSize
new1.08 KB

the attached patch shows the correct node view with status message after a comment is successfully posted.

moshe weitzman’s picture

StatusFileSize
new1.08 KB

fix a typo

TDobes’s picture

I've tested the patch and it works just fine for me. +1 from me for fixing this extremely annoying bug in the core.

kyber’s picture

Regarding your patch. I note you didn't remove the comment_referer_save/load methods. any reason why? They seem unneeded.

kyber’s picture

Ah, actually, I see why... you only removed it in one place. Really though, all the redirects will have the same problem. Moderate Comments and Save Settings also do the same thing. Going to try to apply the same procedure in those places in my build.

dries’s picture

I think we have to look for a more generic system that can be used for any form, and not limit ourselves to the comment forms. For example, when you are on the node overview page (admin/node), you click 'edit node', and click 'Submit', you end up looking at the node (node/view/xxx), and you might have to travel all the way back to the node overview page.

I've shared a quick patch a few weeks ago to attempt this, but it was not 100% either. Maybe we should look into that once more.

moshe weitzman’s picture

returning to 'active' status. the ideal patch has not arrived yet. until then, we suffer.

moshe weitzman’s picture

StatusFileSize
new5.85 KB

I'm in a better mood today, and posting a better patch. This patch assures that the page which is shown after add/edit/delete of a comment is correct. You are now shown the node upon which you commented, except in the Admin case when you are brought back to the admin/comment page. This was a bit screwy before, as an admin editing a comment from the usual interface used to get thrown into the admin section after editing.

Another benefit of this patch is that it removes a couple redirects [i.e. drupal_goto()], which cause unnecessary delay for the user, and a bit mre server load.

The technique used to achieve this is a querystring param called 'destination' is introduced as needed. When present, this param holds the _GET['q'] which should be shown after the post is accepted.

This same technique works for other forms like node and user. In fact, we already use this technique in the login form.

I will soon followup with a separate patch which addresses the admin/node case that Dries describes.

dries’s picture

I'm not sure it is an issue here but pages with hidden destination fields can get cached (which is why I want to get rid of it for the login block). I'll test it out a bit.

moshe weitzman’s picture

the caching issue which dries mentions is not an issue. just try the patch and you'll see.

dries’s picture

I committed an alternative solution to HEAD. We no longer show an incorrect page after posting a comment. My solution does not have an 'admin case' like Moshe's though. We need to find a generic solution for that as this affects more than just the comment administration pages. Marking this fixed for now.

gábor hojtsy’s picture

Since this is a problem in 4.4.x too, why not commit a fix in there too?

moshe weitzman’s picture

Category: bug » feature
mabster’s picture

A question on this one, guys.

I'm now running the HEAD version (after thinking I was upgrading to 4.4.1 - d'oh!!!) and have noticed something odd with posting comments.

After I post a comment, I am redirected to "comment/reply/###" (where ### is the node number), rather than "node/view/###". The page I'm redirected to doesn't show the comment I just posted, or any other comments. It just shows the node.

This doesn't seem right to me. Shouldn't I at least see the comment I just posted?

mabster’s picture

Category: feature » bug

Just realised that this will probably get more attention if I switch it back to 'bug report'.

The current behaviour (redirecting you back to a page that doesn't show the comment you just posted) doesn't seem right at all.

moshe weitzman’s picture

Dries: My solution does not have an 'admin case' like Moshe's though. We need to find a generic solution for that as this affects more than just the comment administration pages. Marking this fixed for now.

My patch *did* have a generic solution. The source link may specify a destination path. That path will be shown after the form has completed its processing. I can't think of of a more "generic solution" than that.

moshe weitzman’s picture

Assigned: moshe weitzman » Unassigned
Anonymous’s picture