I assume this is user ignorance, but I can't seem to find any mention in docs, issues or the googleverse...
I'd like to list issue comments in 'Date - Newest First' order, but project_issue appears to ignore my settings on nodetype:issue#comments. When I expose the comments view settings form and try to specify a sort order there, the changes are not persisted. I am able to perform these functions with other node types, so I'm assuming it's project_issue that's causing this behavior.
Am I missing something? Is this by design, an oversight, a bug, or something else altogether?
Thanks

Comments

dww’s picture

Status: Active » Closed (works as designed)

Yeah, currently since project_issue is doing so many unholy things with comments on issues, it hard-codes that comments will always be rendered chronologically, with an increasing comment id number (e.g. this is comment #1). Trying to reverse the order is going to completely confuse people trying to read an issue. Instead of trying to handle this flexibility, we just force the comment settings to behave a certain way on project_issue nodes so things don't get out of hand. This *might* change as part of the D7 upgrade, but then again, there's pretty much no good reason to reverse the comment order (unless you like to confuse the hell out of your users trying to make sense of an issue). ;)

Cheers,
-Derek

jaskho’s picture

Status: Closed (works as designed) » Active

I see this:

/* project_issue/includes/comment.inc .. project_issue_comment_pre_render() */

  // Force the correct formatting.
  $_GET['mode'] = COMMENT_MODE_FLAT_EXPANDED;
  $_GET['sort'] = COMMENT_ORDER_OLDEST_FIRST;

I'm curious what is "correct" about this, but I guess I'll take it for given. I'll leave this open for now in case some generous soul with too much time on his/her hands feels like helping me understand...

jaskho’s picture

Status: Active » Closed (works as designed)

woops - Derek's reply came in while I was typing - Thanks Derek!

jaskho’s picture

I'm not so sure that reverse order would be a bad thing in all cases. I'm using project_issue in a private system with a small number of trained/dedicated users. fwiw...

jaskho’s picture

A work-around for anyone so inclined:

IMPORTANT: This may cause unwanted and even catastrophic side-effects - know what you're doing!

/**
 *  This would go in a custom module; here we're assuming 
 *   it's called 'custom' and the function below would go in 
 *   custom/custom.module 
 *
 *  For this to work, your module must be weighted so as to
 *   run /after/ project_issue.  Otherwise your changes will be 
 *   ignored
 **/

function custom_nodeapi(&$node, $op, $teaser, $page) {
  switch ( $op ) {
    case 'view':
      // override project_issue's forcing of comment sort order
      if( $node->type == 'project_issue' ) {
        unset( $_GET[ 'sort' ] );
      }
      break;
  } 
}