Problem/Motivation

The feed icon is currently displayed for all nodes where the comment setting is open or closed, but not hidden. I believe that the icon should only be displayed when the commetns are open.

RSS-feeds are intended to allow a user to keep track of changes. If the comments are closed (but still visible) then there will not be any update to the feed. Presenting an RSS-feed in this situation gives the user the expectation that the feed will have updates.

Proposed resolution

Change the function commentrss_node_feed_access to block access unless the comments are open. In commentrss.module, starting from line 95:

/**
 * Access callback; determines if the user can access a node's comment RSS.
 */
function commentrss_node_feed_access($node, $check_view_access = TRUE) {
  // Old line: 
  // return $node->comment != COMMENT_NODE_HIDDEN && variable_get('commentrss_node', TRUE) && user_access('access comments') && (!$check_view_access || node_access('view', $node));
  // Replaced by new line:
  return $node->comment == COMMENT_NODE_OPEN && variable_get('commentrss_node', TRUE) && user_access('access comments') && (!$check_view_access || node_access('view', $node));
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Status: Needs review » Needs work

I don't think we should change the access function since this will make the feed result in a 403 even when comments are visible. I would support not showing the feed icon on the node but still making the feed itself available.

nbouhid’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
828 bytes

Patch based on Dave Reid suggestions.

erickbj’s picture

Status: Needs review » Reviewed & tested by the community

I applied the patch against 7.x-2.x and confirmed both cases (behavior before and after patch). Patch works fine.

  • larruda committed 652d8fa on 7.x-2.x authored by nbouhid
    Issue #1508096 by nbouhid: RSS feed should be hidden if comments are...
larruda’s picture

Status: Reviewed & tested by the community » Closed (fixed)
Issue tags: +#ciandt-contrib