Index: drupalorg.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalorg/drupalorg.info,v
retrieving revision 1.3
diff -u -F^f -u -F^f -r1.3 drupalorg.info
--- drupalorg.info	2 Jul 2008 23:03:44 -0000	1.3
+++ drupalorg.info	9 Sep 2008 23:44:12 -0000
@@ -1,5 +1,5 @@
 ; $Id: drupalorg.info,v 1.3 2008/07/02 23:03:44 kbahey Exp $
 name = Drupal.org
 description = "Customizations and tweaks for drupal.org"
-dependencies = project_issue cvs simplenews
+dependencies = project_issue cvs simplenews project
 package = Drupal.org
Index: drupalorg.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalorg/drupalorg.module,v
retrieving revision 1.28
diff -u -F^f -u -F^f -r1.28 drupalorg.module
--- drupalorg.module	8 Sep 2008 18:23:28 -0000	1.28
+++ drupalorg.module	9 Sep 2008 23:44:12 -0000
@@ -259,3 +259,44 @@ function drupalorg_display_block_externa
   }
 }
 
+/**
+ * Implementation of hook_project_issue_assignees().
+ */
+function drupalorg_project_issue_assignees(&$assigned, $node) {
+  global $user;
+  if (empty($user->uid) || empty($node->pid)) {
+    return;
+  }
+  $project = node_load($node->pid);
+  if (!isset($project) || $project->type != 'project_project') {
+    return;
+  }
+
+  // Determine if the user has CVS access at all.  If not, the user can't be a maintainer
+  // of the current project and thus we can skip the next, more expensive query.
+  if (project_use_cvs($node->pid)) {
+    if (db_result(db_query("SELECT COUNT(*) FROM {cvs_accounts} WHERE uid = %d AND status = %d", $user->uid, CVS_APPROVED))) {
+      // Make an array with all maintainers of the current project.
+      $result = db_query("SELECT cpm.uid, u.name FROM {cvs_project_maintainers} cpm INNER JOIN {users} u ON cpm.uid = u.uid WHERE cpm.nid = %d", $node->pid);
+      $maintainers = array($project->uid => $project->name);
+      while ($row = db_fetch_object($result)) {
+        $maintainers[$row->uid] = $row->name;
+      }
+
+      // Determine if the current user is one of the maintainers of the project.
+      if (isset($maintainers[$user->uid])) {
+        unset($maintainers[$user->uid]);
+      }
+      else {
+        return;
+      }
+      // Add any maintainers of this project who are not already
+      // in the $assigned array to the array.
+      foreach ($maintainers as $uid => $name) {
+        if (!isset($assigned[$uid])) {
+          $assigned[$uid] = $name;
+        }
+      }
+    }
+  }
+}
