Module removes "X new comments" link in node links

Todd Nienkerk - June 30, 2009 - 21:51
Project:Talk
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

This module is removing the "X new comments" link, which is useful for return visitors.

Also, this module appears to be losing track of the number of new issues. For example, a visitor who recently visited the talk page will suddenly see an "X new comments" link when the talk page is disabled for that content type -- even though he/she had already seen those comments. Solving the "X new comments" problem above will likely solve this, too.

#1

greggles - July 6, 2009 - 02:04

I can confirm this bug...but I don't see how it is happening, exactly.

That link is in the comment_new_comments element in the links array. The talk module adds stuff to this array, but it doesn't implement a hook_link_alter that might remove this value.

One other thought is that the talk module somehow renders the comments in a way that marks them as "read" for the user...

#2

Todd Nienkerk - July 13, 2009 - 17:36

Lines 86-87 cause the "X comments" link to be removed -- and presumably the "X *new* comments" link as well:

        $output['comment_original_value'] = $node->comment;
        $output['comment'] = 0;

Additionally, the implementation of hook_link() uses the same array keys as comment.module, which overwrites those existing $links instead of using hook_link_alter().

Line 101:

      $result['comment_comments'] = array(

Line 108:

        $result['comment_add'] = array(

Lines 114-115:

        $result['comment_forbidden']['title'] = theme('comment_post_forbidden', $node);
        $result['comment_forbidden']['html'] = TRUE;

#3

Todd Nienkerk - July 13, 2009 - 20:35

After much experimentation, I now understand why hook_link() is used instead of hook_link_alter(): You can't alter the links because they aren't created to begin with by the comment module. (Commenting status is set to 0, which causes all commenting stuff to be bypassed entirely.)

#4

greggles - July 15, 2009 - 16:37
Status:active» duplicate

I've now committed #520154: Provide number of "new" comments token which provides a token for the comment count which, in combination with #506658: Customizable titles everywhere using tokens fixes this problem.

The only remaining problem is that if you look at node/NID then your "last viewed timestamp" in the history table gets updated. The comment "new" calculation is based on this value rather than on actually "viewing" the comments. This same problem shows up when comments are "paged" and you look at the first page of comments - all comments on all pages suddenly become "old" to you even though you haven't seen them.

I'm not sure we should try to fix that problem here, though, so marking this as a duplicate of the token in title issue.

#5

askit - September 15, 2009 - 09:55
Status:duplicate» needs review

I'm facing new comment count issue and don't think the above comment #4 resolved it. Showing correct new comment count to returning users are helpful...

#6

greggles - September 15, 2009 - 12:13
Status:needs review» active

Can you describe the "new comment count" issue?

There are at least 2 or 3 potential issues and without more detail it's not clear which problem you are describing.

#7

askit - September 16, 2009 - 02:11

Here are details.

1. Assuming there is a node with 3 comments added after user A visited the Talk page, then User A sees there are 3 new comments with the new comment count in a View.
2. He clicks new comment link and arrives at Talk page. He views the page and thus views all comments.
3. He opens the view with new comment count again and will find the new comment count is still 3.

The reason is Comment module doesn't take the node/comments viewed by the user when he visits Talk page. We may get it work by modifying comment module but you know, we shouldn't. I'm using Talk module for a site that will be put into production soon so your kind hep will be appreciated.

 
 

Drupal is a registered trademark of Dries Buytaert.