going through my set of patches off of drupal cvs that i needed to make to get things working.

Comments

Wesley Tanaka’s picture

by the way, i think the idea here: http://drupal.org/node/40256

would cause these kinds of problems to be flushed out very quickly.

Wesley Tanaka’s picture

please commit me!

Also, for those searching for bugs using the search:

comment off default disabled disable new node forum topic comments ignore admin setting

Anonymous’s picture

This fixes the forum bug for 4.7 too. I think drupal sets comments disabled by default, so this would be better.

if (!isset($node->comment)) {
  $node->comment = variable_get("comment_$node->type", COMMENT_NODE_DISABLED);
}
morbus iff’s picture

I'm confused on this one - check comment_nodeapi, 'validate'. The $node->comment is being set there, to the default READ_WRITE (which I think is the right setting, not DISABLED) - why isn't it becoming a part of the $node? Isn't validate supposed to be called before save?

chx’s picture

in validate you can't change anything. validate validates.

morbus iff’s picture

Version: x.y.z » 4.7.0-beta1
morbus iff’s picture

StatusFileSize
new1.8 KB

This is the same patch as wtanaka's, but removes the useless set in comment_nodeapi, validate.

aaron’s picture

+1 to Morbus's patch. And definitely keep it READ_WRITE. (This also fixes http://drupal.org/node/41152 )

aaron’s picture

Status: Needs review » Reviewed & tested by the community

Sorry, forgot to set the status -- this does the job (Morbus's patch)

Anonymous’s picture

Morbus's one looks correct...

dries’s picture

Status: Reviewed & tested by the community » Needs work

Ugly patch. Why do we set that field in node_save()? We don't do that for any of the other 'default values'?

morbus iff’s picture

Status: Needs work » Needs review
StatusFileSize
new1.94 KB

You're right. Attached a new one.

Wesley Tanaka’s picture

I've applied http://drupal.org/files/issues/_40563_comments_0.patch

against 4.7.0-test2, and it works for me.

morbus iff’s picture

Status: Needs review » Reviewed & tested by the community
morbus iff’s picture

Version: 4.7.0-beta1 » 4.7.0-beta2
Cvbge’s picture

Version: 4.7.0-beta2 » x.y.z

Tested, works as expected.

Steven’s picture

Status: Reviewed & tested by the community » Needs work

Why are we providing a form value for a comment option in node.module? This does not make sense.

morbus iff’s picture

Previously, we were doing this in comment_nodeapi 'validate' - that code still remains, actually, and is removed as part of the original patch. Chx tells me that validate no longer (or maybe, never did - I dunno) modifies the form variables, so it can't happen there. The only other place it *could* happen would be in comment_nodeapi 'insert' and 'update', right? In which case, that'd be an entirely new query, just to set the node.comment? Need direction for proper handling of this.

merlinofchaos’s picture

Status: Needs work » Needs review
StatusFileSize
new2.79 KB

This is all, IMO, on the wrong track.

For one, we shouldn't be reverting to the default in any case. If an admin set it, just because a user edits it doesn't mean it should revert. And it doesn't have to.

formsapi gives us:

  $form['user_comments']['comment'] = array(
    '#type' => 'value',
    '#value' => $selected,
  );
chx’s picture

StatusFileSize
new3.1 KB

Merlin, you are on the right track. Let's see this version.

chx’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new2.63 KB

I moved the prepare op so that patch is smaller. To my eyes, this seems correct. The prepare bit happens when the node is new, otherwise node_load loads $node->comment. The form part is correct: admins can change this, users are not presented with this change but in place there is a value typed field (which is immutable) with same value.

UncleD’s picture

I thoroughly tested this patch, creating different users (non admin) before and after applying the patch. Before applying it, SELECT comment from node where nid=NODE# returned 0, and on the site, no comments being added was possible. After applying, nid=NODE# returned 2, and commenting was possible.

UncleD’s picture

Tested http://drupal.org/files/issues/node-comment_1.patch just posted by chx. Works perfect. +1

Wesley Tanaka’s picture

What happens if an unprivileged user POSTS data on their own?

chx’s picture

Nothing. When the form is built, the node->comment gets a value and that won't be overwritten in form builder.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)