Everything seems fine - but I have comments under the node view and on the separate tab - is this the intended default behavior or a bug? Apologies for asking - but I haven't used this module before.

Comments

lodey’s picture

To get around this I created a node template for the content type I wanted the Discussion functionality - In my case Books.

Simply don't render the comments - it still works in the tabs.

Might be a nice setting to have in the Content type config.

jacobson’s picture

Ditto. I have this same problem and have had to do the same as Lodey suggested.

jarodms’s picture

Assigned: Unassigned » jarodms
Status: Active » Needs review

byproduct of #1215894. please retest this with the latest DEV version.

jarodms’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

JSCSJSCS’s picture

Status: Closed (fixed) » Active

I just installed talk dev (7.x-1.0-beta3+5-dev) version on D7.12 and I see the comments on both the node and the talk tab on all articles except one. Only one article is working as expected and I do not see any difference between that one and any other except that the comments were set to hidden by the module.

If I edit that one article's comment settings to "OPEN", then it stops working correctly (comments on article and in comments tab).

If I disable and re-enable the module, that one article has its comments settings setback to "HIDDEN" and will work again. This one article is not the first or last article node written. It is beyond me why the talk module decided to work on only this one article.

I tried creating a new article while the module was enabled and it did not work either.

Apologize in advance if it was poor form to change status to active, but I think it went to fixed for lack of input.

Anonymous’s picture

I am seeing this also, in the -dev version of 7 May 2012.

Anonymous’s picture

OK, the problem here is with talk_node_load.

It clobbers the comments conditional on:

talk_activated($node->type) && arg(0) == 'node' && !arg(2)

I don't know what this is trying to do. I'm using path aliases, and arg() sees those, not "node", so the code above definitely can't work.

Just changing it to TRUE works for me. Presumably there's some case in which that is the wrong thing?

Anonymous’s picture

Another thing. According to the documentation for hook_node_load:

This hook should only be used to add information that is not in the node or node revisions table, not to replace information that is in these tables (which could interfere with the entity cache).

I'm not sure, is there a caching issue here because we're "replacing information" by bashing the $node object ?

Anonymous’s picture

Answer: yes, there is a caching problem!

This sets the node to have $node->comment = 0. (That should actually be COMMENT_NODE_HIDDEN , not the literal 0.)

The problem is that this is cached and persists. So if you go to the talk page and post a comment, after submitting it, you get the error message "This discussion is closed: you can't post new comments.", generated by comment_reply in comment.pages.inc when $node->comment != COMMENT_NODE_OPEN (which is what it finds in the cache).

As far as I can tell, comment posting with Talk now only works when the arg(0) == 'node' && !arg(2) condition fails. (And that condition is wrong.)

[I have checked, and this code comes from the D6 version. But apparently there are core differences between D6 and D7 so it no longer works.]

It would seem that some better way of hiding the comments is needed...

Anonymous’s picture

So, the problem here is that talk_node_load() is called during the bootstrap, before Drupal has translated the path alias. Specifically, during drupal_bootstrap, it calls drupal_get_normal_path in order to translate aliases, during which it calls entity_load, which eventually calls talk_node_load(). So in that function, arg() still sees the alias, not /node/NID.

So, we need to clobber the comments later than hook_node_load. (And it would be better to do it in a cleaner way that doesn't muck up caching.)

It would seem that talk_node_view() is the right place. I removed talk_node_load, and added the following to talk_node_view():

  // Remove comments from page if we're viewing just it (and Talk is enabled for the node type).
  if (talk_activated($node->type) && arg(0) == 'node' && !arg(2)) {
    $node->content['comments'] = array();
  }

This seems to work. If I run into further problems, I'll follow up here.

geerlingguy’s picture

Assigned: jarodms » Unassigned
Priority: Normal » Major
Status: Active » Needs review
StatusFileSize
new473 bytes

And here's a patch (attached).

bago’s picture

#12 worked for me.

geerlingguy’s picture

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

Status: Reviewed & tested by the community » Fixed

Looks like this patch was committed on Nov. 7 and is present in 1.0: http://drupalcode.org/project/talk.git/commit/bd4be67

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.