e.g. http://fullfact.org/find/health

I assume this would be the same for node types where comments are disabled when comment.module is enabled.

Using, Solr 3.5, Drupal 7.14

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Nick_vh’s picture

This is the bad code!

  if (isset($node->last_comment_timestamp) && !empty($node->comment_count)) {
    $document->ds_last_comment_timestamp = apachesolr_date_iso($node->last_comment_timestamp);
    $document->ds_last_comment_or_change = apachesolr_date_iso(max($node->last_comment_timestamp, $node->changed));
  }
  else {
    $document->ds_last_comment_or_change = apachesolr_date_iso($node->changed);
  }
  $document->is_comment_count = isset($node->comment_count) ? $node->comment_count : 0;

Is there a way to easily see if a node can have comments or not?

Nick_vh’s picture

Version: 7.x-1.0-beta19 » 7.x-1.x-dev
Status: Active » Needs work
willmoy’s picture

Thanks for the quick response!

From node_schema:

'comment' => array(
        'description' => 'Whether comments are allowed on this node: 0 = no, 1 = closed (read only), 2 = open (read/write).',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),

That becomes $node->comment

So if $node->comment == 0;
a comment count shouldn't be displayed.

I suggest also that if $node->comment == 1 and there are no comments, it shouldn't be displayed (because probably comments have always been turned off and displaying 0 comments in that case would be unhelpful).

Nick_vh’s picture

Category: bug » feature

Marking as feature request, not critical for now. Hopefully someone can provide us with a patch

willmoy’s picture

FileSize
953 bytes

Well, I can provide a patch (which I think is trival). I've attached it. The problem is I can't test it because we don't run dev, the test suite won't run on the version we have installed, and I don't have a test installation. But here it is for what it's worth!

I defer to you, but I think it is a bug to say something has 0 comments when comments aren't even enable on the site (even if not a very important one) — but the way the markup is you can't hide just the comments bit with CSS.

Nick_vh’s picture

Status: Needs work » Needs review
FileSize
880 bytes

This looks a little cleaner to me. Can you confirm this works for you?

Nick_vh’s picture

FileSize
1.74 KB

Seems like there was more crap in that function

Nick_vh’s picture

FileSize
4.17 KB
Nick_vh’s picture

Version: 7.x-1.x-dev » 6.x-3.x-dev
Status: Needs review » Patch (to be ported)

Committed to D7, needs backport for D6.

Thanks for raising this issue

Nick_vh’s picture

Status: Patch (to be ported) » Fixed

Committed to 6.x-3.x. Thanks!

Nick_vh’s picture

Status: Fixed » Closed (fixed)
swentel’s picture

Issue summary: View changes

Adding version info