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 4645e038 Allow for 2+ ICLA emails sep. by comma or space
4645e038 is described below
commit 4645e03817da6d864d17f97d26caf3f75dbde24d
Author: Sebb <[email protected]>
AuthorDate: Sat May 20 14:14:52 2023 +0100
Allow for 2+ ICLA emails sep. by comma or space
---
lib/whimsy/asf/icla.rb | 10 ++++++++--
lib/whimsy/asf/mail.rb | 4 +++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/whimsy/asf/icla.rb b/lib/whimsy/asf/icla.rb
index 4115646d..21d1ec8e 100644
--- a/lib/whimsy/asf/icla.rb
+++ b/lib/whimsy/asf/icla.rb
@@ -17,7 +17,7 @@ module ASF
# public name for the individual; should match LDAP
attr_accessor :name
- # email address from the ICLA
+ # email address from the ICLA (may include multiple values, separated by
space or comma)
attr_accessor :email
# lists the name of the form on file; includes claRef information
@@ -97,7 +97,7 @@ module ASF
unless @@email_index
@@email_index = {}
# Allow for multiple emails separated by comma or space
- each {|icla| icla.email.downcase.split(/[, ]/).each {|m|
@@email_index[m] = icla}}
+ each {|icla| icla.emails.each {|m| @@email_index[m.downcase] = icla}}
end
@@email_index[value.downcase]
@@ -286,6 +286,12 @@ module ASF
def noId?
self.id == 'notinavail'
end
+
+ # return emails split by comma or space
+ def emails
+ email.split(/[, ]/)
+ end
+
end
class Person
diff --git a/lib/whimsy/asf/mail.rb b/lib/whimsy/asf/mail.rb
index 62fc8bbb..dffacac8 100644
--- a/lib/whimsy/asf/mail.rb
+++ b/lib/whimsy/asf/mail.rb
@@ -31,7 +31,9 @@ module ASF
# load all ICLA emails in one pass
ASF::ICLA.each do |icla|
person = Person.find(icla.id)
- list[icla.email.downcase] ||= person
+ icla.emails.each do |email|
+ list[email.downcase] ||= person
+ end
next if icla.noId?
list["#{icla.id.downcase}@apache.org"] ||= person