diff --git a/includes/comment.inc b/includes/comment.inc index 84d46ae..b8f394c 100644 --- a/includes/comment.inc +++ b/includes/comment.inc @@ -574,9 +574,39 @@ function project_issue_update_by_comment($comment_data, $op) { // Update the issue title. $node = node_load($comment_data->nid, NULL, TRUE); // Don't use cached since we changed data above. $node->title = $comment_data->title; + $node->changed = time(); - // This also updates the changed date of the issue. - node_save($node); + // Saving the node would potentially create a new revision and change the node + // revision author to the current user. + // @see node_save(), _node_save_revision() + // Because of that, node_save() cannot be invoked here. Instead, we update + // the node record manually, and resemble the remaining logic of node_save(). + + // Disable new revision flag, and perform the update. + $node->revision = 0; + $op = 'update'; + + // Let modules modify the node before it is saved to the database. + node_invoke_nodeapi($node, 'presave'); + + db_query("UPDATE {node} SET title = '%s', changed = %d WHERE nid = %d", array( + $node->title, + $node->changed, + $node->nid, + )); + + // Call the node specific callback (if any). + node_invoke($node, $op); + node_invoke_nodeapi($node, $op); + + // Update the node access table for this node. + node_access_acquire_grants($node); + + // Clear the page and block caches. + cache_clear_all(); + + // Clear the static node_load() cache. + node_load(NULL, NULL, TRUE); // Return the object of comment data we used to update the issue. return $comment_data;