If I set an option "preview comments before submit" to true at Issue content type page (that is a default value), I will not get "Save" button after Previewing.
After switching to "no need to preview before posting", than "Save" button appears.

Comments

dww’s picture

Title: Can't add comments to issues » non-admin users can't add comments to issues if previewing is required
Priority: Minor » Normal

Interesting. At first, I couldn't reproduce this on a local test site. However, once I switched to a regular authenticated user instead of uid 1, I started seeing the bug. Steps to reliably reproduce:

1) admin/content/node-type/project-issue
2) Open the "Comment settings" fieldset and configure "Preview comment:" to "Required".
3) Visit an issue node as any user other than uid 1 (even a user with full admin permissions on the site doesn't work).
4) Enter a comment, press "Preview", and behold that a "Save" button never appears, even if there are no validation errors.

There's a work-around (don't require previews), but otherwise, I'd call this critical.

cmundi’s picture

Thanks for confirming that I'm not crazy... at least not for this.

I'm pretty good at breaking stuff. I have to be, because my customers are *really* creative. :)

Carlos

aclight’s picture

I just followed the instructions in comment #1 and am unable to reproduce this. I tried using the drupal.org testing profile with preview required for issue nodes. I also tried using users with roles such as regular authenticated user, doc maintainer, cvs admin, and full admin. All users were able to post comments on issues with no problems.

I cvs up'ed drupal core and all project* code earlier today. Maybe it was a core bug that just got fixed?

cmundi’s picture

Unknown. All I can tell you is that I started from a clean download of drupal 6.10 from d.o.

Linux Ubuntu Intrepid Ibex kernel 2.6.27-11
Apache 2.2.x
MySQL 5.1.x
PHP 5.2.6-2

I've already mentioned the modules (views, upload_comments, project, project_issue) that I installed.
The only customization I've done is to bump up the php memeory limit to 48M as needed.

Thanks!
-C

aclight’s picture

Hm...downgrading drupal core to 6.10 didn't cause the problem to appear, either.

For reference, here are all permissions assigned to the authenticated user role that seem to me to have any chance of being relevant.

Comment module: all *except* "administer comments"
Comment upload: all permissions
Project module: access own projects, access projects, browse project listings
Project issue module: all permissions
Upload module: all permissions

cmundi’s picture

aclight: Bingo!

I had comment upload completely disabled even for authenticated users. Even thought I knew the module was required for issues, I did not know if it was needed only for admin or for all users. The descriptions of the module permissions led me to believe that they were relevant only to uploading files:

upload files to comments
view files uploaded to comments

I always start out very conservatively and turn things on as needed. So I missed this one entirely.

Why these would prevent preview from working and prevent the save buton from appearing at all is a mystery to me.

But that's the deal.

Thanks for your help!

Carlos

dww’s picture

k8’s picture

6.13 I had this problem even with uid 1.

evoltech’s picture

I was unable to reproduce this issue on project_issue-HEAD, even with the following permissions unset for a non uid 1 user: upload_module[upload files, view uploaded files]. I will write a fix for this bug if someone can help me reproduce it.

evoltech’s picture

Assigned: Unassigned » evoltech
marcp’s picture

So it sounds like there's only an issue if Comment Upload is disabled? #7 says this may be a documentation issue, and a closed one at that.

hunmonk’s picture

Project: Project issue tracking » Comment Upload
Component: Comments » Code

i spent a long time looking at this, and although i have no idea how to fix it, i've determined several things:

  1. this is definitely a bug in comment_upload, not project_issue. i was able to replicate problems like this with other node types when comment upload is involved.
  2. this looks like a bug with the form caching.
  3. when comment upload is enabled, comments are set to require previews, and the comment form is set to 'below post', the comment form is cached b/c of the AHAH stuff comment_upload uses.
  4. even though comment_upload sets $form_state['rebuild'] = TRUE; in comment_upload_comment_form_validate(), the form is not properly being rebuilt when preview is clicked.
  5. it looks like this is because $form_state['submitted'] is FALSE in the case of previews, thus drupal_rebuild_form() is never called. from drupal_get_form():
      if ((!empty($form_state['storage']) || !empty($form_state['rebuild'])) && !empty($form_state['submitted']) && !form_get_errors()) {
        $form = drupal_rebuild_form($form_id, $form_state, $args);
      }
    
evoltech’s picture

Assigned: evoltech » Unassigned
dww’s picture

Thanks for debugging. Sounds like a re-run of these:

#579900: Previewing comments is broken by FAPI change in Drupal core 6.14
#302240: button broken due to fix various problems when using form storage

However, I'm pretty sure this bug has existed long before 6.14 came out, so I'm not really sure what to do here...

jeremy’s picture

Subscribe. This is affecting users of the support module when they enable the comment_upload module and grant the 'upload files to comments' permission. It seems to have only started happening with Drupal 6.14. (In my testing, it affects the UID 1 user and any user in a role with the 'upload files to comments' permission granted to it.)
#599304: Preview doesn't work in Drupal 6.14

inkscarab’s picture

I am also adding that the same issue appeared on my last update to 6.14. I had to turn previewing comments to not required to get the save button. Previewing comments fails to preview and thus users never got the save button.

jeremy’s picture

I have a website running 6.14 (now 6.15) with an old version of the comment_upload module and the latest support module, and this bug does not affect that website. That website is using a dev-snapshot of the comment_upload module from 6.x-1.x-dev (2008-Dec-11). So whatever is causing this bug was introduced into the comment_upload module between then and now.

kevinwalsh’s picture

greggles’s picture

On a 6.15 site I tried applying the fix from #302240: button broken due to fix various problems when using form storage and the problem remains. So, I think there is more to it than that alone.