Comment module declares a path 'node/%node/%' which turns out to produce various artefacts, such as if you go to a path like 'node/66/xxx' where 66 is a valid nid. The node is displayed, but the tabs disappear. During earlier discussions with Karoly, I suggested making this path 'node/%node/comment/%'. On IRC he suggested rewriting comment module some so we wan use a load function and a path like 'node/%node/%comment'.

So, the first question is - are there ever any public-facing links like node/66/77 where 66 is a nid and 77 is a cid? If not, my suggestion is reasonable. This is similar to 'node/%node/edit' or 'node/%node/outline'.

Karoly's suggestion could also work, but would mean you can't pass params to a node page (perhaps a problem, for example, when embedding a view in a node). The reason for this is that you'd get a 'Not found' any time the second param is not a valid cid if comment module is enabled.

CommentFileSizeAuthor
#2 path_despair_1.patch952 bytespwolanin

Comments

pwolanin’s picture

Title: comment module: node/%/% the path of dispair » comment module: node/%/% the path of despair
pwolanin’s picture

Status: Active » Needs review
StatusFileSize
new952 bytes

seems this path does not serve any function, since node module already passes any second argument on to comment_render. It should be removed.

chx’s picture

Title: comment module: node/%/% the path of despair » Remove node/%/% from comment_menu
Priority: Normal » Critical
Status: Needs review » Active

Let's investigate what happens when you remove this bothersome definiton and land on the path node/123/456. As node/123/456 and node/123/% is not defined, the next in order is node/123 which is defined, so you will call node_page_view(node_load(123), 456). So the page callback is the same. Let's examine the access callback -- we are checking whether a valid node is given but this is needless as the current _load handling call will check for you anyways... We also check for && $cid. This is pretty pointless, as the only way this can fail is that if you enter node/123/0 -- Drupal will show you the node and every comment and that's the same way it was in five. This was a pretty braindead conversion from me.

The only functionality change is that node/123/456 does not show the node tabs with this definition. I can't fathom why that's good, it's very inconsistent.

chx’s picture

Status: Active » Reviewed & tested by the community

Opsie, cross posting. But yes the patch is good.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)