This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 26f44dfc Accidentally dropped during re-org
26f44dfc is described below

commit 26f44dfcacf1cd5ac9f4b27f99d7b255ac09294d
Author: Sebb <[email protected]>
AuthorDate: Thu Mar 12 13:55:05 2026 +0000

    Accidentally dropped during re-org
---
 lib/whimsy/asf/mail.rb | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/lib/whimsy/asf/mail.rb b/lib/whimsy/asf/mail.rb
index b15ccbb0..ac523500 100644
--- a/lib/whimsy/asf/mail.rb
+++ b/lib/whimsy/asf/mail.rb
@@ -3,6 +3,45 @@ require 'weakref'
 module ASF
   # Convenience functions related to emails or mailing lists.
   class Mail
+    # return a Hash containing complete list of all known emails, and the
+    # ASF::Person that is associated with that email.
+    def self.list
+      begin
+        return @list.to_h if @list
+      rescue NoMethodError, WeakRef::RefError
+      end
+
+      list = {}
+
+      # load info from LDAP
+      people = ASF::Person.preload(['mail', 'asf-altEmail'])
+      people.each do |person|
+        (person.mail + person.alt_email).each do |mail|
+          list[mail.downcase] = person
+        end
+      end
+
+      # load all member emails in one pass
+      ASF::Member.each do |id, text|
+        Member.emails(text).each do |mail|
+          list[mail.downcase] ||= Person.find(id)
+        end
+      end
+
+      # load all ICLA emails in one pass
+      ASF::ICLA.each do |icla|
+        person = Person.find(icla.id)
+        icla.emails.each do |email|
+          list[email.downcase] ||= person
+        end
+        next if icla.noId?
+
+        list["#{icla.id.downcase}@apache.org"] ||= person
+      end
+
+      @list = WeakRef.new(list)
+      list
+    end
 
     # return a list of people ids, their public-name, whether they are an ASF 
member, and email addresses
     def self.people_mails

Reply via email to