? 253825_8_drupalorg.patch
Index: /Applications/MAMP/htdocs/rg/drupal/sites/all/modules/drupalorg/drupalorg.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalorg/drupalorg.info,v
retrieving revision 1.2
diff -u -p -r1.2 drupalorg.info
--- drupalorg.info	12 Apr 2008 19:57:55 -0000	1.2
+++ drupalorg.info	4 May 2008 01:18:02 -0000
@@ -1,4 +1,4 @@
 ; $Id: drupalorg.info,v 1.2 2008/04/12 19:57:55 killes Exp $
 name = Drupal.org
 description = "Customizations and tweaks for drupal.org"
-dependencies = project_issue cvs simplenews
+dependencies = project_issue cvs simplenews project
Index: /Applications/MAMP/htdocs/rg/drupal/sites/all/modules/drupalorg/drupalorg.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalorg/drupalorg.module,v
retrieving revision 1.19
diff -u -p -r1.19 drupalorg.module
--- drupalorg.module	12 Apr 2008 19:57:55 -0000	1.19
+++ drupalorg.module	4 May 2008 01:18:03 -0000
@@ -153,3 +153,45 @@ function drupalorg_project_page_link_alt
   // Link to security handbook page.
   $all_links['support']['links']['report_security_issue'] = l(t('Report a security issue'), 'security-team');
 }
+
+/**
+ * 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;
+        }
+      }
+    }
+  }
+}
