Got this bug report from a client:

This morning, I was playing around with editing/customizing page layouts. When I clicked "Comment" in the customization sidebar, an AJAX HTTP error occured (and I had to quit Safari to close out, since the display box was so long). See attached screenshot.

The screenshot they're referring to is attached.

I'm able to verify the issue! Here are some more details about what's happening:

  1. The "Comment" tab is only available if you have the comment module enabled and are in a node context (like using the IPE on a Node view page).
  2. The issue only happens if the node in question has comments disabled OR the user doesn't have permission to post comments.
  3. The AJAX which loads the previews of all the Panes on the "Comment" tab, is receiving a "302 Moved Temporarily" redirect to the node itself - what it's showing in the alert box is the HTML of the node view page
  4. The redirect is coming from comment_reply() in modules/comment/comment.pages.inc. It will redirect when (no surprise) the node has comments disabled OR the user doesn't have permission to post comments (like in #2).

I'm not sure what the solution is here... Panopoly Magic's preview functionality will blindly call comment_render() which could redirect via drupal_goto(). Maybe we add a "pane blacklist" where we could list any panes that aren't safe to render in the preview?

CommentFileSizeAuthor
Screen Shot 2014-01-14 at 10.10.50 AM.png471.6 KBdsnopek
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

caschbre’s picture

I'm curious if this is an issue with ajax + https. Looking at the screenie it looks like it's trying to do an https request which I've often had trouble with when it comes to ajax.

Is there any caching / varnish / etc. involved?

What about securepages or some other security / https type module?

Can you reproduce this on a fresh panopoly site without other modules enabled?

Can you reproduce it with just http?

dsnopek’s picture

@caschbre: I've already tracked this issue down. Check out the bullet points in the issue description - they describe exactly what's happening. Using the "Network" tab in Chrome Developer tools I could see that this was a 302 redirect and look at the full page source of what it's dumping in there. It all comes back to the drupal_goto() in comment_reply().

caschbre’s picture

Ah, sorry... thought you were still looking for the issue.

I'm not familiar with the panopoly magic code. Can you point me to where it's handling the preview?

dsnopek’s picture

Ya know... I'm not as familiar as I'd like to be with the Panopoly Magic code either. :-) I'm pretty sure that's where the previews on the add pane modal come from, but just now I attempted to find the appropriate lines and couldn't. :-/

Unfortunately, I don't have time to do any more digging right now. This bug isn't a priority for this client, so in the short term I've got to move on to other things. If anyone can track down the code responsible for generating those previews, that'd be awesome!

lsolesen’s picture

Seems to be related to #2172429: Add comment when editing a panels page gives ajax error - or maybe even a duplicate.